473,320 Members | 2,098 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,320 software developers and data experts.

Displaying different form fields based on radio button selection

Hello,

I am trying to create a form which when initially displayed only has 2
radio buttons. Then based on which radio button you select the
appropriate form appears below the radio buttons.

What is the best of way of achieving this?

Can I layer the form objects?

I am relatively new to C# so any help on this matter would be
gratefully recieved.

Regards

Lloyd
Nov 15 '05 #1
2 3924
One way to do it is to place each set of controls on it's own panel, then
simply hide and show the appropriate panel based on the radio buttons.

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 15 '05 #2
Hi,

Use a Panel WebControl to group each set of controls , and depending of
which one is selected set the Panel.Visible property accordly.

This is a similar code but using a DropDownList instead:
in the aspx code:
<asp:DropDownList Runat=server ID="SelectSectionDRP"
OnSelectedIndexChanged="ChangeSection" AutoPostBack=True></asp:DropDownList>

in the code behind:
protected void ChangeSection( object sender, System.EventArgs e)
{
if ( SelectSectionDRP.SelectedIndex == 0 )
{

CarsInvolvedPanelControls.Visible = PassengerPanel.Visible = false;
return;
}
if ( SelectSectionDRP.SelectedIndex == 1 )
CarsInvolvedPanelControls.Visible = true;
else
PassengerPanel.Visible = true;

}

//Note
CarsInvolvedPanelControls & PassengerPanel are two Panel.

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"lltaylor" <ll**********@yahoo.com> wrote in message
news:ac**************************@posting.google.c om...
Hello,

I am trying to create a form which when initially displayed only has 2
radio buttons. Then based on which radio button you select the
appropriate form appears below the radio buttons.

What is the best of way of achieving this?

Can I layer the form objects?

I am relatively new to C# so any help on this matter would be
gratefully recieved.

Regards

Lloyd

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Para | last post by:
Hi , I am working on a project using C/C++ in linux environment. Our program right now using the command line(console window) inputs and starts executing. command on console are to start...
3
by: Chris Marsh | last post by:
Hello, Is it possible w/ASP.Net to set the property of the radio button control to 'read-only' after the user has made their selection before hitting an 'submit' button? Think of a multiple...
1
by: FunkHouse9 | last post by:
I'm trying to develop an order page and in one section, the customer specifies a shipment type using radio buttons that is submitted to the shopping cart. There are 4 buttons. If either of the...
1
FOE2272
by: FOE2272 | last post by:
I am working on an Access DB that has a form with 8 radio buttons. The customers are those who bid on a project. each customer has the following information: Company Contact Adress City
3
by: shanmukhi | last post by:
Hi All, how to control the selection of radio buttons in jsp. i think i have to write java script for that.. my code is like this <form name="form1"> <input type="radio" name="male">Male...
0
by: Gary W. Smith | last post by:
Hello, I have a simple form with a radio button group on it and I need to do some basic validation based upon which button is checked. Here is a little more detail. if button one is...
4
by: pureadrenaline | last post by:
Hey Guys, Please could anyone help me out with the following form I need to create a validation on the email field only if the user checked the radio button named Email. Thanks in advance. ...
2
by: makunta | last post by:
Hi all, First here is the website of what I am trying to do: http://www.exmhosting.com/ Locate the login form on the top-right of the page. What I need to do is allow the user to sign into...
1
by: sahilansari | last post by:
I have two Radio buttons. radio_date & radio _reg. Initially radio_date is checked by default.(On form load)....So i want to display two textboxes & related labels.All this data is in a table.As...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.