
checkbox,gridview
protectedvoidGridView1_RowDataBound(objectsender,GridViewRowEventArgse){foreach(GridV...
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
foreach (GridViewRow gvr in this.GridView1.Rows)
{
Control ctl = gvr.FindControl("CheckSingle");
CheckBox ck = (CheckBox)ctl;
if (ck.Checked)
{
//TableCellCollection cell = gvr.Cells;
//string wid = cell[0].Text + ",";
SqlConnection scon = new
SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
scon.Open();
SqlCommand scmd = new SqlCommand("insert into za(bm,zhi) values ('GridView.Rows[ClientID].Cells[0].Text',1)", scon);
scmd.ExecuteNonQuery();
scmd.Dispose();
scon.Close();
}
}
}
为什么数据库里没反应,怎么改下 展开
{
foreach (GridViewRow gvr in this.GridView1.Rows)
{
Control ctl = gvr.FindControl("CheckSingle");
CheckBox ck = (CheckBox)ctl;
if (ck.Checked)
{
//TableCellCollection cell = gvr.Cells;
//string wid = cell[0].Text + ",";
SqlConnection scon = new
SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
scon.Open();
SqlCommand scmd = new SqlCommand("insert into za(bm,zhi) values ('GridView.Rows[ClientID].Cells[0].Text',1)", scon);
scmd.ExecuteNonQuery();
scmd.Dispose();
scon.Close();
}
}
}
为什么数据库里没反应,怎么改下 展开
展开全部
写在BUTTON事件里。
你写错地方了。
你写错地方了。
展开全部
RowDataBound,前台设置成true了吗???还有,你判断下,是事件没执行,还是sql语句没执行。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你的checkbox的自动回发属性没有设置吧!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这个是 要 要触发 的功能。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询