DoubleClick on ListBox

M

Mike

Hello,

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?)?

Thanks
Mike
 
G

Guest

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="http://schemas.microsoft.com/intellisense/ie5"><script
function TrackDblClick(index

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

</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
code
=====================================================
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

Kashyp
Aztec Software and Technology Services Ltd
Bangalor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top