Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Best use of RadioButtons

Reply
Thread Tools

Best use of RadioButtons

 
 
Jim in Arizona
Guest
Posts: n/a
 
      09-08-2006
In html and ASP, I would easily code radio buttons as needed, such as:

<input type="radio" name="question1" value="1">1</input>&nbsp;
<input type="radio" name="question1" value="2">2</input>&nbsp;
<input type="radio" name="question1" value="3">3</input>

If I use the <asp:radiobutton> control, I can do this:

<asp:RadioButton ID="RB1" GroupName="question1" runat="server" />1
<asp:RadioButton ID="RB2" GroupName="question1" runat="server" />2
<asp:RadioButton ID="RB3" GroupName="question1" runat="server" />3

My problem with this is that I can't specify a value. When the form is
filled out, I need a value between 1 and 5 to be inserted into the
database. In the above example, the value is actually whatever the ID is
and since I can't have duplicate IDs, then that rules out the use of
<asp:RadioButton />.

The <asp:radiobuttonlist /> would probably work ok but I can't place the
radio buttons (the <asp:listitem />) side by side. It only puts the
radio buttons vertically.

<asp:RadioButtonList ID="RBL1" runat="server">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
</asp:RadioButtonList>

Looking at the source after the page is rendered, I can see that it
creates a table to display the radiobuttons. The value is present
though, which is what I would need for my database.

I was hoping to not use <input> tags this time around and use more
'advanced' coding techniques, but I don't know how I would go about
using server controls considering my display and value requirements.

Any input would be appreciated.

TIA,
Jim
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamically add RadioButtons in Repeater =?Utf-8?B?Q2hyaXN0aWFhbiBOaWV1d2xhYXQ=?= ASP .Net 1 05-26-2005 11:50 AM
best way to process a group of radiobuttons? Carlos ASP .Net 0 02-18-2005 03:32 PM
Looping through dataset outputting HTML radiobuttons Robert H ASP .Net 0 12-04-2003 11:02 PM
RadioButtons & DataGrid RB ASP .Net 0 08-11-2003 04:29 PM
Radiobuttons and textbox with autopost Sean ASP .Net 1 08-06-2003 12:32 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57