B
bissatch
Hi,
I am trying to output a list of checkboxes. Using ASP .NET controls, I
was able to create the following:
<label for="colour_red">Red: </label><asp:CheckBox ID="colour_red"
runat="server" /><br />
<label...
<label...
<label...
I figured because they all follow the same HTML structure there would
be a way of outputing a list of these using the Repeater control. For
example:
<asp:Repeater id="colours" runat="server">
<ItemTemplate>
<label for="...">...</label><input type="checkbox" name="..."
value="..." /><br/>
</ItemTemplate>
</asp:Repeater>
An XML file was used to store the data (key, name, label text) and I
was able to fill in the missing parts '...' from this. This seemed to
work fine BUT because I had now changed the checkbox tag from
<asp:CheckBox... to <input type="checkbox"... it didnt take advantage
of the ViewState feature and my selections were not saved when the
form was submitted and the page reloaded.
I have also tried using <asp:CheckBoxList... but dont like the way
that the server creates the HTML for me. I think in this case it even
used a table for layout which is a Neddy-no-no in my book.
Whats the best way to go about this? Thanks
Burnsy
I am trying to output a list of checkboxes. Using ASP .NET controls, I
was able to create the following:
<label for="colour_red">Red: </label><asp:CheckBox ID="colour_red"
runat="server" /><br />
<label...
<label...
<label...
I figured because they all follow the same HTML structure there would
be a way of outputing a list of these using the Repeater control. For
example:
<asp:Repeater id="colours" runat="server">
<ItemTemplate>
<label for="...">...</label><input type="checkbox" name="..."
value="..." /><br/>
</ItemTemplate>
</asp:Repeater>
An XML file was used to store the data (key, name, label text) and I
was able to fill in the missing parts '...' from this. This seemed to
work fine BUT because I had now changed the checkbox tag from
<asp:CheckBox... to <input type="checkbox"... it didnt take advantage
of the ViewState feature and my selections were not saved when the
form was submitted and the page reloaded.
I have also tried using <asp:CheckBoxList... but dont like the way
that the server creates the HTML for me. I think in this case it even
used a table for layout which is a Neddy-no-no in my book.
Whats the best way to go about this? Thanks
Burnsy