473,385 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 1634
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Oscar Monteiro | last post by:
I Have to sets of Radio buttons like so: <input type="radio" name=p1 value=1> <input type="radio" name=p1 value=2> <input type="radio" name=p1 value=3> <br> <input type="radio" name=p2 value=1>...
6
by: Craig Keightley | last post by:
I have a page that has n number of radio groups (yes/No) how can i prevent the form being submitted if more than one radio group is not selected? By default all radio groups are unchecked ...
2
by: James P. | last post by:
Help, I need to display radio buttons on a form. The data is from SQL table: each row in each table is displayed as a radio button. I have multiple SQL tables so I understand I need to put...
1
by: kenny8787 | last post by:
Hi, can anyone help here? I have the following code generated from a database, I want to have javascript calculate the costs of the selected items using radio buttons, subtotal the costs and...
2
by: dpazza | last post by:
Hi, I'm creating a quiz on using a form in VB 2005 express. I have four sets of questions and answers (labels and radio buttons) and I change between which set of questions is currently shown on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.