David_zu
asked on
Rewrite HTML Output of ASP.NET Control
I am using standard ASP.NET CheckboxList control in a page.
The output in HTML is
However, I need the html output to be something like
Anyway to rewrite the output? Or have to make a custom control?
<asp:CheckBoxList ID="lstNames" runat="server" RepeatColumns="1" RepeatDirection="Vertical" RepeatLayout="Flow"/>
The output in HTML is
<span id="lstNames">
<input id="lstNames_0" type="checkbox" name="lstNames$0" value="4554" />
<label for="lstNames_0">Aka</label><br />
<input id="lstNames_1" type="checkbox" name="lstNames$1" value="4546" />
<label for="lstNames_1">Joe</label><br />
<input id="lstNames_2" type="checkbox" name="lstNames$2" value="4548" />
<label for="lstNames_2">Joy</label><br />
<input id="lstNames_3" type="checkbox" name="lstNames$3" value="4545" />
<label for="lstNames_3">Pai</label><br />
<input id="lstNames_4" type="checkbox" name="lstNames$4" value="4550" />
<label for="lstNames_4">Susan</label><br />
<input id="lstNames_5" type="checkbox" name="lstNames$5" value="4551" />
<label for="lstNames_5">Zoe</label></span>
However, I need the html output to be something like
<li><label for="lstNames_0"><input id="lstNames_0" type="checkbox" name="lstNames$0" value="4554" />
Aka</label></li>
<li><label for="lstNames_1"><input id="lstNames_1" type="checkbox" name="lstNames$1" value="4546" />
Joe</label></li>
<li><label for="lstNames_2"><input id="lstNames_2" type="checkbox" name="lstNames$2" value="4548" />
Joy</label></li>
<li><label for="lstNames_3"><input id="lstNames_3" type="checkbox" name="lstNames$3" value="4545" />
Pai</label></li>
<li><label for="lstNames_4"><input id="lstNames_4" type="checkbox" name="lstNames$4" value="4550" />
Susan</label></li>
<li><label for="lstNames_5"><input id="lstNames_5" type="checkbox" name="lstNames$5" value="4551" />
Zoe</label></li>
Anyway to rewrite the output? Or have to make a custom control?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER