在DataGrid中设一个checkbox选项,如果选中则执行更新某个字段值,不选中则不更新,我想在以下代码中只要选了一个就中止循环,请高手赐招,谢谢.代码如下<asp:CheckBox id=CheckBox1 runat="server"  OnCheckedChanged="DataGrid_ChkChange" Checked='<%#DataBinder.Eval(Container.DataItem,"zd")%>' AutoPostBack="True">
c#: public   void  DataGrid_ChkChange(object   sender,   System.EventArgs   e) 
{
   for(int   i=0;i<DataGrid1.Items.Count;i++)   
   {   
   CheckBox   check=(CheckBox)DataGrid1.Items[i].Cells[5].FindControl("CheckBox1");
    string id =DataGrid1.Items[i].Cells[1].Text;
   if(check.Checked)   
   {    
  fbtime=new DateTime();
  fbtime=DateTime.Now ;
  string fbdt=fbtime.ToString(); 
      bool zd=true;
  string SQLStatement="UPDATE news SET zd="+zd+", dt='"+fbdt+"' WHERE id ="+id;
  string strconn = System.Configuration.ConfigurationSettings.AppSettings["SQLConnString"].ToString() +System.Web.HttpContext.Current.Server.MapPath( System.Configuration.ConfigurationSettings.AppSettings["dbPath"])  + ";";
  OleDbConnection MyConnection;
  MyConnection=new OleDbConnection(strconn);
  OleDbCommand Cmd=MyConnection.CreateCommand(); 
  Cmd.CommandType=System.Data.CommandType.Text;
  Cmd.CommandText=SQLStatement; 
  MyConnection.Open();
  Cmd.ExecuteNonQuery();
  MyConnection.Close();
    
   }
   else
   {
   fbtime=new DateTime();
   fbtime=DateTime.Now ;
   string fbdt=fbtime.ToString(); 
   bool zd=false;
   string SQLStatement="UPDATE news SET zd="+zd+", dt='"+fbdt+"' WHERE id ="+id;
   string strconn = System.Configuration.ConfigurationSettings.AppSettings["SQLConnString"].ToString() +System.Web.HttpContext.Current.Server.MapPath( System.Configuration.ConfigurationSettings.AppSettings["dbPath"])  + ";";
   OleDbConnection MyConnection;
   MyConnection=new OleDbConnection(strconn);
   OleDbCommand Cmd=MyConnection.CreateCommand(); 
   Cmd.CommandType=System.Data.CommandType.Text;
   Cmd.CommandText=SQLStatement;
   MyConnection.Open();
   Cmd.ExecuteNonQuery();
   MyConnection.Close();
    
   }
          
   }
   }