双击中继器上的链接按钮

本文关键字:链接 按钮 中继器 双击 | 更新日期: 2023-09-27 17:53:28

我在中继器上有链接按钮。我的问题是,我将如何能够有一个链接按钮在一个中继器内双击,而不是一个单一的点击?

这是我的代码:

    <td class="style2">
    <asp:LinkButton ID="lblName" runat="server" Text='<%# Bind("Name") %>' CommandName="Name" CommandArgument='<%# Eval("Code") %>'>
    </asp:LinkButton></td> 
c#

protected void rptrInsurance_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                switch (e.CommandName)
                {
                    case "Delete":
                        {
                            HCSInsurance oInsuranceDelete = new HCSInsurance();
                            Insurance oInsurance = new Insurance();
                            List<InsuranceLabel> lstName = oInsuranceDelete.RetrieveInsuranceList();
                            foreach (InsuranceLabel item in lstName)
                            {
                                var code = e.CommandArgument;
                                if (item.InsuranceCode.ID == code.ToString())
                                {
                                    oInsurance.InsuranceCode = item.InsuranceCode;
                                    oInsuranceDelete.DeleteInsurance(oInsurance);
                                    bind();
                                }
                            }
                        }
                        break;
                    case "Edit":
                        {
                            Session["InsuranceCodeID"]= e.CommandArgument.ToString();  
                            Response.Redirect("~/InsuranceCarrierNew.aspx");
                        }
                        break;
                    default:
                        {
                           //bind();
                            HCSInsurance oHCSInsurance = new HCSInsurance();
                            Insurance oInsurance = new Insurance();
                            string code = Convert.ToString(e.CommandArgument);
                            oInsurance = oHCSInsurance.RetrieveInsurance(code);
                            Labelvisible();
                            //string
                            lblName.Text = oInsurance.Name;
                            lblAddress.Text = oInsurance.Address1;
                            lblCity.Text = oInsurance.City;
                            lblState.Text = oInsurance.State;
                            lblZip.Text = oInsurance.Zip;
                            lblDphone.Text = oInsurance.ContactTelephone;
                            lblDfax.Text = oInsurance.ContactFax;
                        }
                        break;
                }
            }
        }
        catch (Exception ex)
        {
        }
    }

双击中继器上的链接按钮

当您意识到您想要实现的目标存在于客户端时,有一个用于双击事件的jQuery API,如:

$('id').dblclick(function() {
     // Call something here.
});

这样做的缺点是,您可能希望通过AJAX调用而不是回发来更改实现,也可能只提交表单并为后端代码编辑必要的参数。