开发者

Re: How to displayy checkboxes! [closed]

开发者_开发问答 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 13 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜