Re: How to displayy checkboxes! [closed]
I need help to figure out how to display checkboxes in a asp:Panel. I need 2 columns and the data is from the database.
Here's the code snippet:
<asp:Panel ID="pnl1" runat="server">
<asp:CheckBoxList ID="cbProduct" runat="server" DataSourceID="dsProductNames"
DataTextField="'<%# Eval("product_name") %>'"
RepeatColumns="2" CellPadding="0" CellSpacing="0" CssClass="cbl">
</asp:CheckBoxList>
<%--OnDataBound="cbl_DataBound"--%>
</asp:Panel>
You're going to want the checkbox class, created in ASP.net markup using:
<asp:CheckBox ...
See http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.checkbox.aspx for documentation.
Take a look at DataList control. Use RepeatColumns property to get 2 columns in a row.
精彩评论