繁体   English   中英

双击中继器上的Linkbutton?

[英]Double click on Linkbutton on a repeater?

我在中继器上有链接按钮。 我的问题是,如何在中继器内部双击而不是单击才能使linkbutton出现?

这是我的代码:

    <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调用而不是回发来更改实现,也可以只提交表单并编辑后端代码的必要参数。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM