Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>you can use <code>GroupName</code> Property of <code>RadioButton</code> Control. </p> <p>if you set the same <code>GroupName</code> for set of <code>RadioButtons</code> you don't need to write the Code Behid which you have written in the above Post/Question, as only one radio button can be selected from the group.</p> <p>but if you want to invoke some action like Disabling <code>TextBox</code> on Particular Radio Button click event you can use following sample code.</p> <p><strong>Example:</strong> in this example i'm taking 3 Radio Buttons all set to Same <code>GroupName</code>, hence only one <code>RadioButton</code> canbe selected at a time.</p> <p>when user selects/checks a RadioButton1 i'm Disabling the TextBox1.</p> <p><strong>Note :</strong> Please Make sure that your <code>RadioButton</code> <code>AutoPostBack</code> Property set to <code>True</code> otherwise events on <code>RadioButton</code> won't be fired.</p> <p><strong>Design Code:</strong></p> <pre><code>&lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:RadioButton ID="RadioButton1" runat="server" Text="DisableTextBox" GroupName="Group1" AutoPostBack="True" OnCheckedChanged="RadioButton1_CheckedChanged"/&gt; &lt;asp:RadioButton ID="RadioButton2" runat="server" GroupName="Group1" AutoPostBack="True"/&gt; &lt;asp:RadioButton ID="RadioButton3" runat="server" GroupName="Group1" AutoPostBack="True" /&gt; </code></pre> <p><strong>Code Behind:</strong></p> <pre><code>protected void RadioButton1_CheckedChanged(object sender, EventArgs e) { if (RadioButton1.Checked) TextBox3.Enabled = false; else TextBox3.Enabled = true; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload