471,327 Members | 2,718 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,327 software developers and data experts.

asp.net radio buttons

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

Feb 14 '06 #1
1 1583
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


--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"hal" <bo******@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
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

Feb 14 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Oscar Monteiro | last post: by
6 posts views Thread by Craig Keightley | last post: by
2 posts views Thread by dpazza | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.