CheckBoxList and RadioButtonList Control Specify layout in ASP.Net 4

In ASP.NET 4, the CheckBoxList and RadioButtonList controls support the following new values for the RepeatLayout property:

* OrderedList – The content is rendered as li elements within an ol element.
* UnorderedList – The content is rendered as li elements within a ul element.

You can use these values like below :

<asp:CheckBoxList ID="CheckBoxList1" runat="server"
RepeatLayout="OrderedList">
<asp:ListItem Text="CheckBoxList" Value="cbl" />
</asp:CheckBoxList>

<asp:RadioButtonList ID="RadioButtonList1" runat="server"
RepeatLayout="UnorderedList">
<asp:ListItem Text="RadioButtonList" Value="rbl" />
</asp:RadioButtonList>

The HTML OutPut would be :

<ol id="CheckBoxList1">
<li> <input id="CheckBoxList1_0" type="checkbox" name="CheckBoxList1$0" value="cbl" /> <label for="CheckBoxList1_0"> CheckBoxList</label> </li>
</ol>

<ul id="RadioButtonList1">
<li> <input id="RadioButtonList1_0" type="radio" name="RadioButtonList1" value="rbl" /> <label for="RadioButtonList1_0"> RadioButtonList</label> </li>
</ul>

2 comments:

Disclaimer

This is a personal weblog. The opinions expressed here represent my own and not those of my employer or anyone else. Should you have any questions or concerns please e-mail me at sharepointprogrammingblogger@gmail.com .

Copyright (c) 2010 @ myshaepointwork.blogspot.com. All rights are reserved.Do Not Copy.

@ Learning SharePoint.com