在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
//全选 function checkAll(){ var items = document.getElementsByTagName("input"); for(var i =0;i<items.length;i++){ if(items[i].type == "checkbox" && items[i].id.indexOf("CheckBox1")>0){ items[i].checked = document.getElementById("ctl00_ContentPlaceHolder1_GridView1_ctl01_CheckBox3").checked; } } } function checkAlls(){ var items = document.getElementsByTagName("input"); for(var i =0;i<items.length;i++){ if(items[i].type == "checkbox" && items[i].id.indexOf("CheckBox2")>0){ items[i].checked = document.getElementById("ctl00_ContentPlaceHolder1_GridView2_ctl01_CheckBox4").checked; } } } //批量修改删除 string ids = ""; //遍历所有数据行 for (int i = 0; i < GridView1.Rows.Count; i++) { CheckBox chk = GridView1.Rows[i].FindControl("CheckBox1") as CheckBox; if (chk.Checked) { //通过主键获取 ids +="'"+ GridView1.DataKeys[i].Value.ToString()+"'" + ","; } } if (ids.Length == 0) { Response.Write("<script>alert('您没有选择!!!')</script>"); return; } else { //去掉最后逗号 ids = ids.Substring(0,ids.Length-1); //访问数据库 SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=GameCardSale;Integrated Security=True"); string sql = "Update UserInfo set UserRole=3 where UserId in ("+ids+")"; SqlCommand comm = new SqlCommand(sql,conn); conn.Open(); int num = comm.ExecuteNonQuery(); conn.Close(); if (num > 0) { Response.Write("<script>alert('会员通过审核成功!!!')</script>"); } else { Response.Write("<script>alert('网络繁忙!!请稍后再试!!!')</script>"); } GridView1.DataBind(); }
|
请发表评论