By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,959 Members | 1,160 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,959 IT Pros & Developers. It's quick & easy.

DoubleClick on ListBox

P: n/a


I have a ListBox on my webForm and would like to display some information when the user double-clicks on a ListBox's item. But I could not find any "doubleclick" event. How is it possible to add the event to the webcontrol? Or should I build one myself (if so, how?)?

Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Hi Mik

Have a look at the following code
================================================== ====================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title></title><meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"><meta name="vs_targetSchema" content=""><script
function TrackDblClick(index

var selValue = document.forms[0].selTest.options[index].valu

</script></head><body><form><select id="selTest" ondblclick="TrackDblClick(this.selectedIndex)" size="5"><option value="Lohith">Lohith</option><option value="Rush">Rush</option></select></form></body></html
================================================== ========================

What i have shown is a classic HTML code

But you have to remember that a ASP.NET ListBox Server Control gets rendered to the client as a <select> element

So in the Page_Load of the page what you have to do is bind a attribute to the ListBo
================================================== ===
ListBoxControlName.Attributes.Add("ondblclick") ="SomeFunction(this.selectedIndex)"
================================================== ====

on the client side write the javascript "SomeFunction()" method accordingly as you wan

Hope this would solve your proble

Aztec Software and Technology Services Ltd

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.