Prohibited List Control

I want to use a CheckBoxList control that outputs HTML using

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

For 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. 

It seems silly, given that an unorderedlist is suggested as a value for the RepeatLayout attribute. Flow works, which puts them all in between, and also makes a table, but I want to use an unordered list and the style itself.

+4
source share
2 answers

Could this be a problem?

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

In this way, intellisense provides options that are not actually available, in this case "UnorderedList", which is new to .NET 4.0. To fix the problem, follow these steps:

  • Upgrade your project to .NET 4.0.
  • Do not use a value that is not available (in this case "RepeatLayout.UnorderedList")
+9
source
 RepeatDirection="vertical" 

The direction of repetition should be vertical.

+1
source

Source: https://habr.com/ru/post/1401562/


All Articles