简体   繁体   中英

Unordered list checkboxlist control

I want to use a CheckBoxList control which prints out HTML using

<UL>
    <LI><INPUT CHECKBOX></LI>
    <LI>etc</LI>
</UL>

For the markup.

However if I try the following:

<asp:CheckBoxList ID="lstShipsInScope" runat="server" 
     DataSourceID="ShipsInScope" DataTextField="Ship_Name" DataValueField="Ship_Id"
     ondatabound="lstShipsInScope_DataBound" AutoPostBack="True"
     RepeatLayout="unorderedlist" RepeatDirection="horizontal">
</asp:CheckBoxList>

I get:

Parser Error Message: Cannot create an object of type 'System.Web.UI.WebControls.RepeatLayout' from its string representation 'unorderedlist' for the 'RepeatLayout' property.

Which seems silly given that unorderedlist is offered as a value for the RepeatLayout attribute. Flow works, which puts them all in a span and so does table, but I want to use an unorderedlist and do the styling myself.

Could this be the problem?

"In Visual Studio 2010, when you create a project based on the .NET 3.5 framework, the Intellisense and Designer both still function as if the project is .NET 4.0 framework."

Thus intellisense provides options that aren't actually available, in this case "UnorderedList" which is new to .NET 4.0. To resolve the problem, either:

  1. Upgrade the project to .NET 4.0.
  2. Don't use the value that is not available (in this case, "RepeatLayout.UnorderedList")
RepeatDirection="vertical"

重复方向应该是垂直的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM