I had link button on a repeater. My Question is how I'll be able to have linkbutton with a double click inside a repeater not a single click?
here's my code:
<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();
}
}
开发者_StackOverflow社区 }
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)
{
}
}
As you are aware the goal you want to achieve exist in the client side, there is a jQuery API for double-click event, like:
$('id').dblclick(function() {
// Call something here.
});
The downside of this, you might want to change your implementation in having an AJAX call instead of doing a postback, it might be possible also to just submit the form and edit the necessary arguments for your back-end code.
精彩评论