Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 875
deed02392 Avatar asked Mar 15 '12 10:03

deed02392


People also ask

What is the usage of CheckBoxList control with example?

Introduction. The CheckBoxList control provides a multi selection check box group that can be dynamically generated with data binding. It contains an Items collection with members corresponding to individual items in the list.

What is CheckBoxList control in asp net?

The CheckBoxList control renders a list of check boxes. The check boxes can be rendered horizontally or vertically. Unlike the other List controls, a user always can select multiple items when using a CheckBoxList control.

How do you check CheckBoxList is checked or not in Javascript?

Simply check to see if the box clicked was the all option. If it was, then go ahead and change the rest of the boxes. If it isn't, then check all the options to see if they are all checked so you can update the 'All' checkbox.


2 Answers

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")
like image 67
Carl Sharman Avatar answered Oct 08 '22 03:10

Carl Sharman


RepeatDirection="vertical"

The repeat direction should be vertical.

like image 42
sandeep r Avatar answered Oct 08 '22 03:10

sandeep r