Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
I want to use double click event in ASP.NET. I already used this code but it didn't worked for me.
Please help me.
 
protected void Page_Load(object sender, EventArgs e)
    {
          if (!IsPostBack)
            {
               try
        {
              String postBackReferenceForListBox =
 
                this.Page.GetPostBackClientEvent(btnForListBoxDoubleClick, "dblClickfromHiddenButton");
 
                ListBox1.Attributes.Add("ondblclick", postBackReferenceForListBox);
            }
        catch (Exception ex)
        { }
    }
 
}
    private void btnForListBoxDoubleClick_ServerClick(object sender, System.EventArgs e)
    {
        try
        {
            string argument = Request.Params["__EVENTARGUMENT"].Trim();
 
            if (argument == "dblClickfromHiddenButton")
            {
                Response.Write("HI");
                // logic to process the selected item from listbox goes here
            }
        }
        catch (Exception ex)
        { }
 
    }
Posted 7-Mar-11 17:10pm
Edited 7-Mar-11 17:40pm
m@dhu29.4K
v2
Comments
AlbinAbel at 7-Mar-11 23:22pm
   
Avoid using capital letters. It means shouting here

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This[^] would help you. It uses ListBox1.Attributes.Add("ondblclick", ClientScript.GetPostBackEventReference(ListBox1, "move"));
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 668
1 OriginalGriff 396
2 Tadit Dash 345
3 sanket saxena 329
4 Peter Leow 193
0 Sergey Alexandrovich Kryukov 12,109
1 OriginalGriff 7,326
2 Peter Leow 5,003
3 Abhinav S 4,003
4 Maciej Los 3,575


Advertise | Privacy | Mobile
Web04 | 2.8.140421.2 | Last Updated 19 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid