Hi,
Is it possible to catch onMouseClick event for my created Web Control??? I've created rater and I use images in it. I don't want to have buttons in it. When user click one of these images, the website is reloaded and rating is given in the url. If I use onMouseClick event I don't have to use data submitted in url. Any sugestions?
PeaCE
Loading
Scott LyslePosted Apr 11, 2008, 12:53 AM
Sure, when you render the control (or override CreateChildControls), just add an attribute to the control for the on click event (here is an example in vb, it is about the same in C#);
Protected Overrides Sub CreateChildControls() imgButton = New HtmlControls.HtmlInputImage() imgButton.Src = MouseOutImage.ToString() imgButton.Attributes.Add("onmouseover", "this.src='" & MouseOverImage.ToString() & "';") imgButton.Attributes.Add("onmouseout", "this.src='" & MouseOutImage.ToString() & "';") imgButton.Attributes.Add("onclick", JavaScriptCall.ToString()) Controls.Add(imgButton) End Sub