简体   繁体   English

无序列表checkboxlist控件

[英]Unordered list checkboxlist control

I want to use a CheckBoxList control which prints out HTML using 我想使用一个CheckBoxList控件,它使用打印输出HTML

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

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." “在Visual Studio 2010中,当您基于.NET 3.5框架创建项目时,Intellisense和Designer仍然可以像项目是.NET 4.0框架一样运行。”

Thus intellisense provides options that aren't actually available, in this case "UnorderedList" which is new to .NET 4.0. 因此,intellisense提供了实际上不可用的选项,在本例中是“UnorderedList”,它是.NET 4.0的新增功能。 To resolve the problem, either: 要解决此问题,请:

  1. Upgrade the project to .NET 4.0. 将项目升级到.NET 4.0。
  2. Don't use the value that is not available (in this case, "RepeatLayout.UnorderedList") 不要使用不可用的值(在这种情况下,“RepeatLayout.UnorderedList”)
RepeatDirection="vertical"

重复方向应该是垂直的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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