通用js:
<script type="text/javascript">
function delete_mail()
{
msg='刪除后數(shù)據(jù)將無(wú)法恢復(fù),確認(rèn)要?jiǎng)h除所選信息么?';
if(window.confirm(msg))
return true;
else
return false;
}
</script>
1、按鈕刪除
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="TE_ID" HeaderText="管理員編號(hào)" />
<asp:BoundField DataField="USERNAME" HeaderText="登錄用戶名" />
<asp:BoundField DataField="TRUENAME" HeaderText="真實(shí)姓名" />
<asp:BoundField DataField="CJ_TIME" HeaderText="創(chuàng)建時(shí)間" />
<asp:TemplateField>
<ItemTemplate>
<a href="look_teadmin.aspx?bianhao=<%# Eval("TE_ID")%>" onclick="return delete_mail()">永久刪除</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
后臺(tái)
string bianhao = Request.QueryString["bianhao"];
if (bianhao == "" || bianhao == null)
bangding();
else
{
TE_ADMIN_BIZ biz = new TE_ADMIN_BIZ();
biz.Del_Admin_Biz(Convert.ToInt32(bianhao));
bangding();
}
2、LinkButton 刪除
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="TE_ID" HeaderText="管理員編號(hào)" />
<asp:BoundField DataField="USERNAME" HeaderText="登錄用戶名" />
<asp:BoundField DataField="TRUENAME" HeaderText="真實(shí)姓名" />
<asp:BoundField DataField="CJ_TIME" HeaderText="創(chuàng)建時(shí)間" />
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="return delete_mail()" CommandArgument='<%# Eval("TE_ID")%>' OnCommand="page_onclick"> 永久刪除 </asp:LinkButton></td>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
后臺(tái)
protected void page_onclick(Object sender, CommandEventArgs e)
{
int bianhao = Convert.ToInt32(e.CommandArgument);
TE_ADMIN_BIZ biz = new TE_ADMIN_BIZ();
biz.Del_Admin_Biz(Convert.ToInt32(bianhao));
bangding();
}
聯(lián)系客服