2010-09-23 64 views
1

我無法在GridView中禁用CheckBox,我的代碼有什麼問題?有人可以看看我的代碼並提出一些建議。我不能在GridView中禁用CheckBox

foreach (GridViewRow row in GridView1.Rows) 
{ 

      CheckBox ch = (CheckBox)row.FindControl("CheckBox1"); 

      if (ch.Checked) 
      { 

       String ExamineeId = (String)GridView1.DataKeys[row.RowIndex].Value; 

       SqlDataSource1.InsertParameters["ExaminerId"].DefaultValue = ExaminerId; 
       SqlDataSource1.InsertParameters["ExamineeId"].DefaultValue = ExamineeId; 
       SqlDataSource1.InsertParameters["ExamId"].DefaultValue = ExamId; 

       SqlDataSource1.Insert(); 

       CheckBox ch1 = (CheckBox)GridView1.Rows[row.RowIndex].FindControl("CheckBox1"); 
       ch1.Enabled = false; 
      } 

      } 

問候,

回答

0

喔..,u必須使用CheckBox1 2倍!

校驗碼..

複選框ch和複選框ç具有相同CheckBOx1 ..

編輯代碼,請

+1

ohh..thanx.it只是一個小錯誤 – 2010-09-23 11:05:37

相關問題