We help IT Professionals succeed at work.
Get Started

ASP.Net ListBox Double Click Event in VB.Net

1,823 Views
Last Modified: 2015-06-04
Hello,

I'm trying to create a Double Click event for a ListBox in my project.  I found a solution for this using Javascript and some C# but my project is written in VB.Net.  I was hoping someone could assist me in translating this solution into something in VB.Net.  Here's the basics, I think I need something in my Page_load event I just don't know the syntax.


From Stack Overflow:
No, I'm theres no native ListBox Double click.  You can call __doPostBack yourself in a js-function from ondblclick.
<script type="text/javascript">
 <!--
     function ListBox1_DoubleClick() {
         __doPostBack('<%= ListBox1.ClientID  %>', 'doubleclick');
     }
 -->
 </script>

<asp:ListBox id="ListBox1" 
        ondblclick="ListBox1_DoubleClick()" runat="server">
    <asp:ListItem Value="1">One</asp:ListItem>
    <asp:ListItem Value="2">Two</asp:ListItem>
    <asp:ListItem Value="3">Three</asp:ListItem>
    <asp:ListItem Value="4">Four</asp:ListItem>
</asp:ListBox>

Open in new window


codebehind:
public void Page_Load(object sender, EventArgs e)
{
  string parameter = Request["__EVENTARGUMENT"]; // parameter
  // Request["__EVENTTARGET"]; // btnSave
}

Open in new window


It's the Code Behind portion I'm having difficulty with, any assistance is greatly appreciated!!!
Comment
Watch Question
Developer
CERTIFIED EXPERT
Top Expert 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE