.NETGURU
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




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification