绑定 gridview 问题
只能显示出这个checkbox的框但是不能得到值 为什么呢??
前台:
<asp:GridView ID= "GridView1 " runat= "server " AllowPaging = "True " AutoGenerateColumns = "False " Font-Size= "10pt "
HorizontalAlign = "Center " Width= "780px " ShowHeader = "False " borderwidth= "0px ">
<Columns >
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID= "CBox " runat= "server ">
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateField>
</asp:GridView>
后台:
protected void Audi_btn_Click(object sender, EventArgs e)
{
CheckBox chk;
foreach (GridViewRow gvr in GridView1.Rows)
{
chk = (CheckBox)gvr.FindControl( "CBox ");
if (chk.Checked)
{
try
{
SqlCommand sqlcmd = new SqlCommand();
sqlcmd.CommandText = "update MessageBoard set isnew= 'false ' where id= ' " + GridView1.Rows[i].Cells[1].Text + " ' ";
ADOConnectionClass.ConnectingwithoutReturn(sqlcmd);
sqlcmd.Dispose();
}