There is a table with 2 columns and 4 rows with a RadioButton in each column and i need to make sure that the user is able to select 1 RadioButton vertically and horizontally.
So can a RadioButton be assigned with more than 1 GroupName?
For that case then you can use RadioButtonList instead since it has an attribute RepeatColumns which allows you to set the number of columns the RBL will display.
Thanks for the swift reply. I have tried your method and it only allows me to select only one radio button from both columns which is not what i am looking for.
There is a table with 2 columns and 4 rows of radio buttons(RB). Its compulsory for the user to select only 1RB from the 1st column and only 1RB from the 2nd column, plus the user can only select 1RB per row.
cypher_jy
Member
19 Points
41 Posts
Help needed with RadioButtons!
Jun 02, 2009 02:46 AM|LINK
Hi. I need to do something like this:
There is a table with 2 columns and 4 rows with a RadioButton in each column and i need to make sure that the user is able to select 1 RadioButton vertically and horizontally.
So can a RadioButton be assigned with more than 1 GroupName?
vinz
All-Star
116098 Points
16314 Posts
MVP
Re: Help needed with RadioButtons!
Jun 02, 2009 03:10 AM|LINK
For that case then you can use RadioButtonList instead since it has an attribute RepeatColumns which allows you to set the number of columns the RBL will display.
Here's an example:
<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatColumns="2"> <asp:ListItem>A</asp:ListItem> <asp:ListItem>B</asp:ListItem> <asp:ListItem>C</asp:ListItem> <asp:ListItem>D</asp:ListItem> <asp:ListItem>E</asp:ListItem> <asp:ListItem>F</asp:ListItem> <asp:ListItem>G</asp:ListItem> <asp:ListItem>H</asp:ListItem> </asp:RadioButtonList>MessageBox Controls for WebForms |Blog
getchinna_sv
Star
12041 Points
2084 Posts
Re: Help needed with RadioButtons!
Jun 02, 2009 03:35 AM|LINK
Instead of going for radiobutton with table.. you can use RadioButtonList with multiple columns.....
cypher_jy
Member
19 Points
41 Posts
Re: Help needed with RadioButtons!
Jun 02, 2009 03:37 AM|LINK
Thanks for the swift reply. I have tried your method and it only allows me to select only one radio button from both columns which is not what i am looking for.
There is a table with 2 columns and 4 rows of radio buttons(RB). Its compulsory for the user to select only 1RB from the 1st column and only 1RB from the 2nd column, plus the user can only select 1RB per row.
Any idea to this?
vinz
All-Star
116098 Points
16314 Posts
MVP
Re: Help needed with RadioButtons!
Jun 02, 2009 04:07 AM|LINK
You can use JavaScript to validate.. here's an example for your reference:
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> <script type="text/javascript" language="javascript"> function Validate(obj1, obj2) { var box1 = document.getElementById(obj1); var box2 = document.getElementById(obj2); if(box1.checked == true) { box2.checked = false; } } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:RadioButton ID="RadioButton1" runat="server" GroupName="demoGroup" onclick="Validate('RadioButton1','RadioButton4');" Text="Test1" /> <asp:RadioButton ID="RadioButton4" runat="server" GroupName="demoGroup1" onclick="Validate('RadioButton4','RadioButton1');" Text="Test4" /> <br /> <asp:RadioButton ID="RadioButton2" runat="server" GroupName="demoGroup" onclick="Validate('RadioButton2','RadioButton5');" Text="Test2" /> <asp:RadioButton ID="RadioButton5" runat="server" GroupName="demoGroup1" onclick="Validate('RadioButton5','RadioButton2');" Text="Test5" /> <br /> <asp:RadioButton ID="RadioButton3" runat="server" GroupName="demoGroup" onclick="Validate('RadioButton3','RadioButton6');" Text="Test3" /> <asp:RadioButton ID="RadioButton6" runat="server" GroupName="demoGroup1" onclick="Validate('RadioButton6','RadioButton3');" Text="Test6" /> <br /> </div> </form> </body> </html>MessageBox Controls for WebForms |Blog
getchinna_sv
Star
12041 Points
2084 Posts
Re: Help needed with RadioButtons!
Jun 02, 2009 04:11 AM|LINK
check this ... http://www.silverlightshow.net/items/Creating-a-Questionnaire.-The-RadioList-Control.aspx