I am creating a switch list programmatically in C # .NET 3.5 and using RadioButtonList to do this. However, something that is very unpleasant for me is the RepeatLayout property, which can only be set to Flow or Table .
Tables are for tabular data, not for displaying forms. And the stream does not help, because it is not suitable for styling.
What I really want is a nest of divs that I can handle with CSS. It can be done?
Some examples illustrating what I'm talking about, and sample code below.
Stream example
<span id="s1"> <input id="s1_0" type="radio" value="Answer A" name="s1"> <label for="s1_0">Answer A</label> <br> <input id="s1_1" type="radio" value="Answer B" name="s1"> <label for="s1_1">Answer B</label> </span>
Table example
<table border="0" id="s1"> <tbody> <tr> <td><input type="radio" value="Answer A" name="s1" id="s1_0"><label for="s1_0">Answer A</label></td> </tr> <tr> <td><input type="radio" value="Answer B" name="s1" id="s1_1"><label for="s1_1">Answer B</label></td> </tr> </tbody> </table>
What i really want
<div id="s1"> <div> <input type="radio" value="Answer A" name="s1" id="s1_0"> <label for="s1_0">Answer A</label> </div> <div> <input type="radio" value="Answer B" name="s1" id="s1_1"> <label for="s1_1">Answer B</label> </div> </div>
C # code that I use to create a list
I know that such a solution will not be as quick and easy as this, but I put it here so that you can understand in what context I use it.
RadioButtonList rbl = new RadioButtonList { RepeatLayout = RepeatLayout.Table }; foreach (ControlValue cv in MasterControl.listControlValues) { rbl.Items.Add(new ListItem(cv.name, cv.value)); } ControlContainer.Controls.Add(rbl);
source share