Link to home
Start Free TrialLog in
Avatar of David_zu
David_zu

asked on

Rewrite HTML Output of ASP.NET Control

I am using standard ASP.NET CheckboxList control in a page.

<asp:CheckBoxList ID="lstNames" runat="server" RepeatColumns="1" RepeatDirection="Vertical" RepeatLayout="Flow"/>

Open in new window


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>

Open in new window


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>

Open in new window


Anyway to rewrite the output? Or have to make a custom control?
ASKER CERTIFIED SOLUTION
Avatar of Sammy
Sammy
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Rainer Jeschor
Rainer Jeschor
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of David_zu
David_zu

ASKER

OK... Then I think I have to rewrite a custom control. Anyway thanks for your advice.