Server Control Event Handling
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngcontrolscs' list.


Jonathan Austin
I have a C# component that basically implements Javascript Rollovers. It
has been working great. I decided that I would add the option to have it
displayed as normally img tags or through an ImageButton (ie <input>
tag). I needed to use an image button for something I was doing because of
the postback. This is a .cs file therefore there is no interface. In the
code, I have create an Image button and set all of the properties and added
it to the page. That works and everything. Now the question is, how do I
get the Click event from the ImageButton to become part of my class. I was
reading something in the Help files about Bubbling Events, but it didn't
make a whole lot of sense. Just as a note, I found this C# file online
when I was first starting this project. I am not a C# programmer but a
VB.NET programmer though I do understand enough C# to get by.

This is inside of CreateChildControls()
ImageButton btn = new ImageButton();
btn.ID = ID;
btn.CommandName = CommandName;
btn.ImageUrl = this.ImageUrl;
btn.Width = Convert.ToInt16(this.imgWidth );
btn.Height = Convert.ToInt16(this.imgHeight) ;
this.Controls.Add ( btn );
// there is a little extra javascript attributes
in there too

I have tried do
public event ImageClickEventHanlder Click;

then tying it to btn.Click += this.Click but I couldn't get it to
work. Let me know if you need any more code.

Thanks,
Jonathan

--------------------------------------------------------------
Jonathan Austin, President
Click here to reveal e-mail address
Solution Innovations, Inc.
http://www.solutioninnovations.com
(540) 320-4085 (Voice)
(540) 242-3385 (Fax)
--------------------------------------------------------------
Reply to this message...
 
    
David Johnson
I have a C# component that basically implements Javascript Rollovers.
It=20
has been working great. I decided that I would add the option to have
it=20
displayed as normally img tags or through an ImageButton (ie <input>=20
tag). I needed to use an image button for something I was doing because
of=20
the postback. This is a .cs file therefore there is no interface. In
the=20
code, I have create an Image button and set all of the properties and
added=20
it to the page. That works and everything. Now the question is, how do
I=20
get the Click event from the ImageButton to become part of my class. I
was=20
reading something in the Help files about Bubbling Events, but it didn't

make a whole lot of sense. Just as a note, I found this C# file online=20
when I was first starting this project. I am not a C# programmer but a=20
VB.NET programmer though I do understand enough C# to get by.

This is inside of CreateChildControls()
ImageButton btn =3D new ImageButton();
btn.ID =3D ID;
btn.CommandName =3D CommandName;
btn.ImageUrl =3D this.ImageUrl;
btn.Width =3D Convert.ToInt16(this.imgWidth );
btn.Height =3D Convert.ToInt16(this.imgHeight) ;
this.Controls.Add ( btn );
// there is a little extra javascript
attributes=20
in there too

I have tried do
public event ImageClickEventHanlder Click;

then tying it to btn.Click +=3D this.Click but I couldn't get it to=20
work. Let me know if you need any more code.

Thanks,
Jonathan

--------------------------------------------------------------
Jonathan Austin, President
Click here to reveal e-mail address
Solution Innovations, Inc.
http://www.solutioninnovations.com
(540) 320-4085 (Voice)
(540) 242-3385 (Fax)
--------------------------------------------------------------

--=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D_4321634
Reply to this message...
 
    
Jonathan Austin
I solved my problem. I thought it wasn't finding it because it wasn't
showing up in IntelliSense, but it's working now.

At 03:38 PM 5/31/2002 -0400, you wrote:
[Original message clipped]

--------------------------------------------------------------
Jonathan Austin, President
Click here to reveal e-mail address
Solution Innovations, Inc.
http://www.solutioninnovations.com
(540) 320-4085 (Voice)
(540) 242-3385 (Fax)
--------------------------------------------------------------
Reply to this message...
 
 
System.Convert
System.Web.UI.WebControls.ImageButton




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com