Burning Posted February 5, 2004 Posted February 5, 2004 I've been breaking my head with this problem. I have a custom control that exsist of a textbox and as Image. Protected WithEvents _Image As New System.Web.UI.HtmlControls.HtmlImage Now an image does not have a Click event... What do i need to do to add a Click event to it?? Any help will be appreciated! James Quote
Tryster Posted February 9, 2004 Posted February 9, 2004 Why not change the HtmlImage control to be an ASP:ImageButton control? This would be a lot easier than the alternative, which would mean either extending the HtmlImage control, or implementing the postback interfaces in your custom control... Quote
inzo21 Posted February 9, 2004 Posted February 9, 2004 I too am perplexed by this ability and was just about to post a question on it. The reason you wouldn't want to use an ASP image button control is the lack of capability of a mouseover effect which is inherent in the DHTML properties of the HTML image tag. From the research I have done, it looks as though you'll need to write your own handler whose prototype matches that of the event delegate. In other words, you create an event handler (like onClick) for the HTML button. This event handler does something (like change a picture, etc.) based off of the parameter being passed to it. I'm trying to create this same effect by passing the id of the HTML image through the custom event handler which uses a select/case statement in the code behind page to call up the write code. I'm having an issue, however, calling this through a script (as I need to do using the onClick method of the HTML image control). Thus, I'm stuck too! :-) ...Beer Time! again, any help would be much appreciated. thanx, inzo Quote he who forgets will be destined to remember... (E.Vedder)
barski Posted February 10, 2004 Posted February 10, 2004 Why couldn't you just add the onmouseover attribute to the server control and attach a js function? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.