I am trying to find the best way to set up RadioButtons, CheckBoxes, and
textboxes on the fly.
What I am doing is putting on a page questions and answers that the user has
defined in his file. The answers can be RadioButtons, CheckBoxes or a
TextBox. It can only one type. For example, you could have up to 5 Radio
buttons or up to 5 CheckBoxes or 1 TextBox. But you can't mix an match.
What I did at the moment is create all the possible choices and make them
invisible. I will only make the ones I need visible - based on the users
choice for that particular question:
<asp:Label ID="Question1" visible="false" runat="server"/>
<asp:RadioButton "RadioButton11" Visible="false" Group"Question1"
runat"server"/><asp:RadioButton "RadioButton12" Group"Question1"
runat"server"/><asp:RadioButton "RadioButton13" Group"Question1"
runat"server"/><asp:RadioButton "RadioButton14" Group"Question1"
runat"server"/><asp:RadioButton "RadioButton15" Group"Question1"
runat"server"/>
<asp:RadioButton "CheckBox11" Visible="false"
runat"server"/><asp:RadioButton "RadioButton12"
runat"server"/><asp:RadioButton "RadioButton13"
runat"server"/><asp:RadioButton "RadioButton14"
runat"server"/><asp:RadioButton "RadioButton15" runat"server"/>
<asp:TextBox "TextBox1" runat="server"/>
The other way would be to set up only 5 objects for each question:
<asp:Label ID="Question1" visible="false" runat="server"/>
<asp:RadioButton "RadioButton11" Visible="false" Group"Question1"
runat"server"/><asp:RadioButton "RadioButton12" Group"Question1"
runat"server"/><asp:RadioButton "RadioButton13" Group"Question1"
runat"server"/><asp:RadioButton "RadioButton14" Group"Question1"
runat"server"/><asp:RadioButton "RadioButton15" Group"Question1"
runat"server"/>
This only works if you can change the asp object type (which I don't think
you can).
The other way was to dynamically create the objects. Not sure how to do
this or if you can. You can as part of a Datagrid (I believe), but what
about as just an object on a page?
Is there a better way than the way I am doing it?
Thanks,
Tom 1 1313
hello tom -
you should dynamically create the controls and not show/hide all your
choices for sure!
check this code from http://www.codeproject.com/aspnet/dynamiccontrols.asp -
maybe it can give you a hint...- if not just give feedback!
(search for Placeholders in google first!)
regards
Thomas
"tshad" <ts**********@ftsolutions.com> schrieb im Newsbeitrag
news:u2**************@TK2MSFTNGP14.phx.gbl... I am trying to find the best way to set up RadioButtons, CheckBoxes, and textboxes on the fly.
What I am doing is putting on a page questions and answers that the user has defined in his file. The answers can be RadioButtons, CheckBoxes or a TextBox. It can only one type. For example, you could have up to 5 Radio buttons or up to 5 CheckBoxes or 1 TextBox. But you can't mix an match.
What I did at the moment is create all the possible choices and make them invisible. I will only make the ones I need visible - based on the users choice for that particular question:
<asp:Label ID="Question1" visible="false" runat="server"/> <asp:RadioButton "RadioButton11" Visible="false" Group"Question1" runat"server"/><asp:RadioButton "RadioButton12" Group"Question1" runat"server"/><asp:RadioButton "RadioButton13" Group"Question1" runat"server"/><asp:RadioButton "RadioButton14" Group"Question1" runat"server"/><asp:RadioButton "RadioButton15" Group"Question1" runat"server"/> <asp:RadioButton "CheckBox11" Visible="false" runat"server"/><asp:RadioButton "RadioButton12" runat"server"/><asp:RadioButton "RadioButton13" runat"server"/><asp:RadioButton "RadioButton14" runat"server"/><asp:RadioButton "RadioButton15" runat"server"/> <asp:TextBox "TextBox1" runat="server"/>
The other way would be to set up only 5 objects for each question:
<asp:Label ID="Question1" visible="false" runat="server"/> <asp:RadioButton "RadioButton11" Visible="false" Group"Question1" runat"server"/><asp:RadioButton "RadioButton12" Group"Question1" runat"server"/><asp:RadioButton "RadioButton13" Group"Question1" runat"server"/><asp:RadioButton "RadioButton14" Group"Question1" runat"server"/><asp:RadioButton "RadioButton15" Group"Question1" runat"server"/>
This only works if you can change the asp object type (which I don't think you can).
The other way was to dynamically create the objects. Not sure how to do this or if you can. You can as part of a Datagrid (I believe), but what about as just an object on a page?
Is there a better way than the way I am doing it?
Thanks,
Tom
"tshad" <ts**********@ftsolutions.com> schrieb im Newsbeitrag
news:u2**************@TK2MSFTNGP14.phx.gbl...I am trying to find the best way to set up RadioButtons, CheckBoxes, and textboxes on the fly.
What I am doing is putting on a page questions and answers that the user has defined in his file. The answers can be RadioButtons, CheckBoxes or a TextBox. It can only one type. For example, you could have up to 5 Radio buttons or up to 5 CheckBoxes or 1 TextBox. But you can't mix an match.
What I did at the moment is create all the possible choices and make them invisible. I will only make the ones I need visible - based on the users choice for that particular question:
<asp:Label ID="Question1" visible="false" runat="server"/> <asp:RadioButton "RadioButton11" Visible="false" Group"Question1" runat"server"/><asp:RadioButton "RadioButton12" Group"Question1" runat"server"/><asp:RadioButton "RadioButton13" Group"Question1" runat"server"/><asp:RadioButton "RadioButton14" Group"Question1" runat"server"/><asp:RadioButton "RadioButton15" Group"Question1" runat"server"/> <asp:RadioButton "CheckBox11" Visible="false" runat"server"/><asp:RadioButton "RadioButton12" runat"server"/><asp:RadioButton "RadioButton13" runat"server"/><asp:RadioButton "RadioButton14" runat"server"/><asp:RadioButton "RadioButton15" runat"server"/> <asp:TextBox "TextBox1" runat="server"/>
The other way would be to set up only 5 objects for each question:
<asp:Label ID="Question1" visible="false" runat="server"/> <asp:RadioButton "RadioButton11" Visible="false" Group"Question1" runat"server"/><asp:RadioButton "RadioButton12" Group"Question1" runat"server"/><asp:RadioButton "RadioButton13" Group"Question1" runat"server"/><asp:RadioButton "RadioButton14" Group"Question1" runat"server"/><asp:RadioButton "RadioButton15" Group"Question1" runat"server"/>
This only works if you can change the asp object type (which I don't think you can).
The other way was to dynamically create the objects. Not sure how to do this or if you can. You can as part of a Datagrid (I believe), but what about as just an object on a page?
Is there a better way than the way I am doing it?
Thanks,
Tom This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jim Quast |
last post by:
I have an ASP page and a CREGReports002.vbs file coded to export data to
excel. I do this by building variables in a stored procedure. The ASP page
has text boxes, list boxes, and radio buttons. ...
|
by: J Krugman |
last post by:
I have a form with a couple of submit buttons, plus a "pseudolink"
that is also supposed to submit the form; the submitted form data
feeds to a CGI script. The two submit buttons have the name...
|
by: Jason |
last post by:
I have created a c-sharp app that has keyup, keydown events tied to the
form. The form also has some other controls, buttons, labels and 1 custom
control that I made which inherits from user...
|
by: Russell Smallwood |
last post by:
Hello all,
Why can't I wire up an event during the "Raise PostBackEvent" stage of a
postback?
Just in case this is the wrong question, the situation:
deep in the bowls of some code-behind...
|
by: tshad |
last post by:
I am trying to set my radio buttons Programmatically. But no matter what I
do - the 3rd one is always checked - even though I can tell my my trace
statements the other buttons were the ones set.
...
|
by: Roger Withnell |
last post by:
How to I find out what size text the browser is set to?
Thanks in anticipation.
|
by: John Mott |
last post by:
Hi All,
I'm trying to set the defaultbutton for a form to a button contained in a
step template for a wizard control. This is the code in PreRender:
switch (myWizard.ActiveStep.StepType) {...
|
by: Robert J. Bonn |
last post by:
I am setting up a contact list for a musician, who is about to release
her first CD.
She would like a contact list that can track all the people she meets,
who will be in various categories --...
|
by: MangroveRoot |
last post by:
Hi all ...
I've been learning and using PHP for a couple months now,
working on a couple of somewhat different sites.
On one site, I have a page with a form,
and that form includes a couple of...
|
by: fahadqureshi |
last post by:
I have the following code snippet from a larger program which is working perfectly for making a gui and adding buttons to it:
self.B0 = wx.Button(id=wxID_FRAME2B0, label='Choose Cases',
...
|
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...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
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...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
|
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...
| |