我的复读中有一个连接塔顿。 Edit and lnkDelete. 我的问题是,我如何分配选定的价值并删除它?
我的守则如下:
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();
// oInsurance.InsuranceCode.ID = "2";
oInsuranceDelete.DeleteInsurance(oInsurance);
}
break;
case "Edit":
{
}
break;
default:
{
}
break;
}
}
}
catch (Exception ex)
{
}
}
asp.net
<asp:LinkButton ID="lnkEdit" runat="server" onclick="lnkEdit_Click" CommandName="Edit">Edit</asp:LinkButton> <asp:LinkButton
ID="lnkDelete" runat="server" onclick="lnkDelete_Click" CommandName="Delete" OnClientClick="if (!confirm( Are you sure do you want to delelte it? )) return false;">Delete</asp:LinkButton>
</td>