cdemott33
asked on
ASP RadioButton Value?
I added group of <asp:RadioButton> to my page, set it's text value and then went to set the value property but apparently there is no value property. (huh???)
RadioButtonList doesn't work for me because I wish to style my 10 RadioButtons in 2 columns and 5 rows versus having them all stack up vertically. (unless there is a way to do this that I'm not aware of)
So I'm confused. RadioButtonList allows me to assign values but a plain old RadioButton does not.
Help!
RadioButtonList doesn't work for me because I wish to style my 10 RadioButtons in 2 columns and 5 rows versus having them all stack up vertically. (unless there is a way to do this that I'm not aware of)
So I'm confused. RadioButtonList allows me to assign values but a plain old RadioButton does not.
Help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
A <asp:RadioButtonList> allows for text and value properties because it builds labels for each <input> it builds, assigning Text to the label and Value to the <input>. in short it makes sense that there is no text & value property.
To make a <asp:RadioButtonList> behave in the way you described you can set the RepeatDirection and RepeatColumns properties (Note: there is also a RepeatLayout property that will control whether it renders a <table> or using <div> tags.
So you can do this to get two columns, hope that helps:
<asp:RadioButtonList ID="rb1" runat="server" RepeatDirection="Horizonta
<asp:ListItem Text="rb1" Value="1"></asp:ListItem>
<asp:ListItem Text="rb2" Value="2"></asp:ListItem>
<asp:ListItem Text="rb3" Value="3"></asp:ListItem>
<asp:ListItem Text="rb4" Value="4"></asp:ListItem>
<asp:ListItem Text="rb5" Value="5"></asp:ListItem>
<asp:ListItem Text="rb6" Value="6"></asp:ListItem>
</asp:RadioButtonList>