码迷,mamicode.com
首页 > 其他好文 > 详细

Gridview 复选框多选删除操作

时间:2017-12-12 12:25:29      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:temp   inpu   view   oca   false   ext   variables   generate   datetime   

<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" onclick="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++;
}
}
}

Gridview 复选框多选删除操作

标签:temp   inpu   view   oca   false   ext   variables   generate   datetime   

原文地址:http://www.cnblogs.com/zgjin/p/8026856.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!