Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am having a small issue with a checkboxlist and a label.

I need the label (displays error message for the checkboxlist) to be next to the checkboxlist, I have tried a few ways including putting a new html table, span tags but this has not helped.

here is my html, any help would be appreciated.

thanks

XML
<td width="100px">
    Promo Country:<br />
    <br />
    <br />
</td>
<td align="left">
    <asp:CheckBoxList ID="cblCountryAdd"  runat="server" AutoPostBack="True"
        DataSourceID="odsCountries" DataTextField="Name" DataValueField="Country_Code"
        onselectedindexchanged="cblCountryAdd_SelectedIndexChanged">
    </asp:CheckBoxList>
    <asp:Label ID="lblCountryAdd" runat="server"  ForeColor="Red"></asp:Label>
</td>
Posted
Comments
F-ES Sitecore 29-Jun-15 4:48am    
The checkboxlist is one of those annoying asp.net controls you have poor control over. It's better than it used to be, but if the html it generates isn't right for you then you'll need to create your own, or a custom version where you control what is rendered. If you google for custom checkboxlist controls, or checkboxlist controls with custom rendering you should find some examples.

1 solution

Add another td and put your label in that column, you can adjust the width accordingly.
ASP.NET
<td>>
    Promo Country:
</td>
<td >
    <asp:CheckBoxList ID="cblCountryAdd"  runat="server" AutoPostBack="True"
        DataSourceID="odsCountries" DataTextField="Name" DataValueField="Country_Code"
        onselectedindexchanged="cblCountryAdd_SelectedIndexChanged">
    </asp:CheckBoxList>
    
</td>
<td>
    <asp:Label ID="lblCountryAdd" runat="server"  ForeColor="Red"></asp:Label>
</td>
 
Share this answer
 
Comments
Kats2512 29-Jun-15 4:51am    
yeah i did try this but it goes way off.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900