Reputation: 1070
The problem is as: I have horizontal asp:RadioButtonList, with 3 buttons witch i add programaticly C# code The thing is that the third button must be on second line. How can i do it besides creating a new asp:RadioButtonList? I have tried adding br and \r\n to caption but that dose not help me.
ListItem _item1 = new ListItem("1", "1");
ListItem _item2 = new ListItem("2", "2");
ListItem _item3 = new ListItem("3", "3");
rbl.Items.Add(_item1);
rbl.Items.Add(_item2);
rbl.Items.Add(_item3);
Upvotes: 3
Views: 4979
Reputation: 2802
You could look into using CssAdapters they offer a lot of flexibility for tweaking control layouts.
Upvotes: 0
Reputation: 1529
Use the RepeatColumns property ? Set it to 2 and the third one should bump down a line. This creates a column approach. Only downside to it if the labels are long it might not look right.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.radiobuttonlist.repeatcolumns.aspx
If the labels are really long, then I would suggest moving to a repeater or listview and roll your own. You could use a placeholder control in the item template and in the itemdatabound event add the radio buttons based the count or index and use a mod to decide when to place a break element. Definitely a hack though.
Upvotes: 2