473,698 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3943
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:DropDownLi st Runat=server ID="SelectSecti onDRP"
OnSelectedIndex Changed="Change Section" AutoPostBack=Tr ue></asp:DropDownLis t>

in the code behind:
protected void ChangeSection( object sender, System.EventArg s e)
{
if ( SelectSectionDR P.SelectedIndex == 0 )
{

CarsInvolvedPan elControls.Visi ble = PassengerPanel. Visible = false;
return;
}
if ( SelectSectionDR P.SelectedIndex == 1 )
CarsInvolvedPan elControls.Visi ble = true;
else
PassengerPanel. Visible = true;

}

//Note
CarsInvolvedPan elControls & PassengerPanel are two Panel.

Hope this help,

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

"lltaylor" <ll**********@y ahoo.com> wrote in message
news:ac******** *************** ***@posting.goo gle.com...
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
2404
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 program is, ./exe Please enter the selections( displays 1to 6 options) if either of them selected the program starts.
3
2311
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 choice question, in our case it's 'Accept', 'Not Accept' or 'Pending' in a grid column. There are multple rows in the grid maybe 2, 3 or even 10 rows and we want to make it so that the user, when they select 'Accept' in say the second row that the...
1
3339
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 first two are selected, the form should submit the data. If either of the last two are selected, I want the form to require input on a text field to collect an account number (op40_LabelShip). I have gotten the form to require the field, but it...
1
1348
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
11332
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 <input type="radio" name="female">Female <input type="submit" value="submit">
0
1916
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 selected, then we want to do validation on textbox control one and no validation on textbox two. If button two is selected, then we want to do validation on textbox control two and no validation on textbox one.
4
3024
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. <form action="" method="get"> <div align="center"> <table border="0" cellspacing="0" cellpadding="0">
2
6005
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 different sections of the website according to the radio button choice at login. If the user chooses Webmail then they input their email address and password and login. If the user chooses clients they input their username and password and login. ...
1
3388
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 shown below. <tr > <td >Date From <input type="text" name="date_from" id="date_from" value="<?php if($_POST != "") {print $_POST;} else {print date('d-m-Y');} ?>" class="textboxes1" onClick="scwShow(this,event); "...
0
8678
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.