views:

16

answers:

1

I am not able to Disable CheckBox in GridView , whats the problem with my code ? can somebody please take a look at my code and suggest something.

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;
            }

            }

Regards,

A: 

Ohh..,u have used CheckBox1 for 2 times !!!

check code..

checkbox ch and checkbox c having same CheckBOx1..

edit that code please

Sangram
ohh..thanx.it was just a small mistake
TERNA_staff