DoubleClick on ListBox

Discussion in 'ASP .Net' started by Mike, May 6, 2004.

  1. Mike

    Mike Guest

    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
     
    Mike, May 6, 2004
    #1
    1. Advertising

  2. 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
     
    =?Utf-8?B?S2FzaHlwYQ==?=, May 6, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Lozzi

    Firing a function on a doubleclick event

    David Lozzi, Mar 9, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    5,659
    =?Utf-8?B?VGltIFN0YWxs?=
    Mar 9, 2005
  2. Buddy Ackerman

    No Doubleclick event on a Listbox control?

    Buddy Ackerman, May 19, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    2,148
    Brock Allen
    May 19, 2005
  3. =?Utf-8?B?cGVsZWdrMQ==?=

    asp.net 2 : asp:listbox doubleclick and fire event

    =?Utf-8?B?cGVsZWdrMQ==?=, Aug 31, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    848
    bruce barker
    Sep 1, 2007
  4. DoubleClick Event on ListBox

    , Mar 18, 2005, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    191
  5. OfurGørn

    ListBox Click or DoubleClick event for web apps

    OfurGørn, Jul 29, 2005, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    438
    OfurGørn
    Jul 29, 2005
Loading...

Share This Page