0

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> 
Vaccano
  • 78,325
  • 149
  • 468
  • 850
  • Retag. There is no C#3.5 (see http://stackoverflow.com/questions/247621/what-are-the-correct-version-numbers-for-c) – Vaccano Nov 02 '09 at 22:52

2 Answers2

1

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.

Jez
  • 27,951
  • 32
  • 136
  • 233
0

Take a look at DataList control. Use RepeatColumns property to get 2 columns in a row.

Canavar
  • 47,715
  • 17
  • 91
  • 122