asp.net中列表框的双击事件 [英] double click event of list box in asp.net

查看:58
本文介绍了asp.net中列表框的双击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在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)
        { }

    }

推荐答案

[ ^ ]会为您提供帮助.它使用ListBox1.Attributes.Add("ondblclick", ClientScript.GetPostBackEventReference(ListBox1, "move"));
This[^] would help you. It uses ListBox1.Attributes.Add("ondblclick", ClientScript.GetPostBackEventReference(ListBox1, "move"));


这篇关于asp.net中列表框的双击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆