How to disable one radio button in the RadioButtonList1 (asp.net)

E

enahar

I have created RadioButtonList1 having 2 radio buttons in the list.How to
make enable/disable only 1 radio button in the RadioButtonlist.

Thanks for your help.


Regards.
 
D

ddd

I am using the below control
protected System.Web.UI.WebControls.RadioButtonList RadioButtonList1;

It doesnot have enabled property.Thanks
 
E

enahar

I am using the below control
protected System.Web.UI.WebControls.RadioButtonList RadioButtonList1;

It doesnot have enabled property.

Thanks
 
G

Guest

I would replace the RadioButtonList with individual RadioButtons that are
wired to the same event handling method, e.g.

<asp:RadioButton AutoPostBack=True ID="Radiobutton1" Runat="server"
Text="value1" OnCheckedChanged
="Radiobutton_CheckedChanged"></asp:RadioButton>
<asp:RadioButton AutoPostBack=True ID="Radiobutton2" Runat="server"
Text="value2" OnCheckedChanged
="Radiobutton_CheckedChanged"></asp:RadioButton>


And in the codebehind:

protected void Radiobutton_CheckedChanged(object sender, System.EventArgs e)
{
//uncheck all radio buttons
Radiobutton1.Checked = false;
Radiobutton2.Checked = false;
//check the button that was clicked
RadioButton rb = (RadioButton)sender;
rb.Checked = true;
//do any other processing

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top