Gridview 复选框多选删除操作

<asp:GridView ID="Griw_List" runat="server" HeaderStyle-BackColor="YellowGreen" class="table table-bordered table-hover" AutoGenerateColumns="False" GridLines="None" Width="100%">

<Columns>

<asp:TemplateField>

<ItemTemplate>
<asp:CheckBox ID="Chex_Selete" title='<%# Eval("G_xuexiaosn") %>' name='<%# Eval("G_SN") %>' runat="server" />
<asp:Label ID="J_SN" runat="server" Text='<%# Eval("G_SN") %>' Visible="False"></asp:Label>
<asp:Label ID="J_ShenPiZhuangTai" runat="server" Text='<%# Eval("G_ShengJiShenHeZT") %>' Visible="False"></asp:Label>
</ItemTemplate>
<HeaderTemplate>
<input id="Chex_choice" type="checkbox" οnclick="return Chex_choice_onclick()" />
</HeaderTemplate>
</asp:TemplateField>

</Columns>
</asp:GridView>

 

 

 

 

Int32 count = 0;
for (int g = 0; g < this.Griw_List.Rows.Count; g++)
{
CheckBox _CheckBox = (CheckBox)this.Griw_List.Rows[g].FindControl("Chex_Selete");
if (_CheckBox.Checked)
{
Label J_SN = (Label)this.Griw_List.Rows[g].FindControl("J_SN");
Label J_ShenPiZhuangTai = (Label)this.Griw_List.Rows[g].FindControl("J_ShenPiZhuangTai");

if (J_ShenPiZhuangTai.Text != "2")
{
MyJiZheZheng_BaoMingDian.SetDelete(Convert.ToInt32(J_SN.Text), 2, "删除人:" + MyUser.Info.R_Name + "(SN:" + MyUser.Info.R_SN + ")、时间:" + DateTime.Now + "、IP:" + Request.ServerVariables["REMOTE_ADDR"].ToString() + "(" + IPLocation.IPLocation.IPLocate(Server.MapPath("~/App_Data/IPLibrary.Dat"), Request.ServerVariables["REMOTE_ADDR"].ToString()) + ")");

MyNongCun_GangWei.Delete(Convert.ToInt32(J_SN.Text));
count++;
}
}
}

转载于:https://www.cnblogs.com/zgjin/p/8026856.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值