asp.net radio buttons

  • Thread starter Thread starter hal
  • Start date Start date
H

hal

hello,
can someone point me to an example or show me how to grey out or hide a
text box when a certain radio button is selected? i've searched and
read through the internet for a couple of hours and couldn't find an
example of how to do this. Below is the code for my radio button and
text box. I can't figure out the c# code to put in the <script> tag.

<tr>
<td align="left">Progressive After One</td>
<td align="left">

<asp:RadioButton ID="ProgressiveYes" runat="server" Text="Yes"
GroupName="Progressive" />&nbsp;<br />
<asp:RadioButton ID="ProgressiveNo" runat="server" Text="No"
GroupName="Progressive" /></td>
</tr>

<tr>
<td align="left">No Time Penalty</td>
<td align="left"><asp:TextBox ID="NoTime" runat="server"
Width="40px"></asp:TextBox></td>
</tr>

Thanks
 
Hi,

You have two options, if you do it in the server side you use
TextBox.Enabled = false; also you need to put in the radiobuttons's
autopostback = true;

if you want to do it client side, you need to know the clientID of the
textbox (it should be the same than the server side's id but that is not
always true) , :

document.all["NoTime"].disabled = true
 

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

Back
Top