《gridview添加复选框批量操作代码》由会员分享,可在线阅读,更多相关《gridview添加复选框批量操作代码(3页珍藏版)》请在金锄头文库上搜索。
1、效果图如下Aspx 代码Js 部分function CheckAll() /点击全部选择,选取本页面全部记录/因为在Form1中找不到chkSel的CheckBox,所以只好遍历整个documentvar cked = false;cked = document.getElementById(chkSelAll).checked;for (var i = 0; i Gridview 部分全选cs 部分protected void _Del_Click(object sender, EventArgs e)bool flag = true;for (int i = 0; i mentview.R
2、ows.Count; i+)bool ischecked = (CheckBox)commentview.Rowsi.FindControl(chkSel).Checked;if (ischecked)string _comtitle = commentview.DataKeysi.Value.ToString();string sql = delete from comment where comtitle= + _comtitle + and username= + Sessionusername + ;comsql.DB.ExecuteNoReturn(sql);flag = false;if (flag)Page.ClientScript.RegisterStartupScript(this.GetType(), scriptKey, alert(提示信息没有选择数据);, true);else Response.Redirect(apply.aspx);bindcom();