Hi Scott,
Thanks for your feedback.
The .Net listbox web server control does not encapsulate the double click
event(Actually, all the web controls do not encapsulate this event).
So we had to use the client script ondblclick event.
Sample code like this:
<script language="javascript">
function showitem()
{
alert(document.Form1["ListBox1"].options[document.Form1["ListBox1"].selected
Index].text );
}
</script>
private void Page_Load(object sender, System.EventArgs e)
{
ListBox lb=(ListBox)this.FindControl("ListBox1");
lb.Attributes.Add("OnDblClick","showitem()");
}
Note: The showitem() function is client side javascript code.
In the code above, I add the OnDblClick event handler in Page's Load event.
If you want to encapsulate this function into your ListBox server control,
you can override its Render method and add the OnDblClick event handler,
then render out your client side javascript code(i.e. showitem() function)
If you still have anything unclear, please feel free to let me know. I am
glad to work with you.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.