问题描述
foreach(GridView1.Rows中的GridViewRow rowItem)
{
CheckBox chk =(CheckBox)(rowItem.Cells [7] .FindControl("ch1")));
if(chk!= null && chk.Checked)
{
SqlConnection myConnection =新的SqlConnection(数据源= PCIMS051;初始目录= unblockingwebsite;集成安全性= True");
myConnection.Open();
SqlCommand myCommand =新的SqlCommand("INSERT INTO twebsite_unblocking(Requested_Status)" +
值(" 2)",myConnection);
}
}
foreach (GridViewRow rowItem in GridView1.Rows)
{
CheckBox chk = (CheckBox)(rowItem.Cells[7].FindControl("ch1"));
if (chk != null && chk.Checked)
{
SqlConnection myConnection = new SqlConnection("Data Source=PCIMS051;Initial Catalog=unblockingwebsite;Integrated Security=True");
myConnection.Open();
SqlCommand myCommand = new SqlCommand("INSERT INTO twebsite_unblocking (Requested_Status) " +
"Values (''2'')", myConnection);
}
}
推荐答案
这篇关于检查后,GridView内部复选框的状态未更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!