Radiobutton disabling in gridview

997 views Asked by At

I have a Itemtemplate column in Gridview in which there are 3 radio buttons. I want to capture and store the radiobutton clicked in a flag variable. So that next time it is disabled and other radio button is automatically enabled? Can you please help

1

There are 1 answers

0
Jameem On

You must make the AutoPostback property of the particular Radio button true..

Then you can write the code sample as follows...

You must write the code in checked changed event of the particular Radio button...

protected void RadioButton1_CheckedChanged(object sender, EventArgs e)

{

    foreach (GridViewRow i in Gridviewbrands.Rows)
    {

        RadioButton Rd = (RadioButton)i.FindControl("RadioButton2");
        if (Rd.Checked == true)
        {
            Rd.Checked = false;
        }
    }
}