无序列表checkboxlist控件

dee*_*392 4 c# visual-web-developer

我想使用一个CheckBoxList控件,它使用打印输出HTML

<UL>
    <LI><INPUT CHECKBOX></LI>
    <LI>etc</LI>
</UL>
Run Code Online (Sandbox Code Playgroud)

对于标记.

但是,如果我尝试以下内容:

<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>
Run Code Online (Sandbox Code Playgroud)

我明白了:

Parser Error Message: Cannot create an object of type 'System.Web.UI.WebControls.RepeatLayout' from its string representation 'unorderedlist' for the 'RepeatLayout' property.
Run Code Online (Sandbox Code Playgroud)

鉴于无序列表是RepeatLayout属性的值,这似乎很愚蠢.Flow工作,它们全部放在一个范围内,表格也是如此,但我想使用无序列表并自己进行样式设置.

Car*_*man 9

难道这个问题?

"在Visual Studio 2010中,当您基于.NET 3.5框架创建项目时,Intellisense和Designer仍然可以像项目是.NET 4.0框架一样运行."

因此,intellisense提供了实际上不可用的选项,在本例中是"UnorderedList",它是.NET 4.0的新增功能.要解决此问题,请:

  1. 将项目升级到.NET 4.0.
  2. 不要使用不可用的值(在这种情况下,"RepeatLayout.UnorderedList")