The CheckBoxList control creates a multiselection checkbox group that can be dynamically generated using databinding. To specify items that you want to appear in the CheckBoxList control, place a ListItem element for each entry between the opening and closing tags of the CheckBoxList control. The CheckBoxList control inherits from ListControl, which defines some features such as SelectedValue and SelectedIndex properties. These properties handle selecting an item in the list for you. Because the CheckBoxList supports more than one selection, SelectedIndex and SelectedValue return the first selected item's values in the list.
The CheckBoxList control also supports databinding. To bind the control to a datasource, first create a datasource, such as one of the DataSourceControl objects, that contains the items to display in the control. Next, use the DataBind method to bind the data source to the CheckBoxList control. Use the DataTextField and DataValueField properties to specify which field in the data source to bind to the Text and Value properties of each list item in the control, respectively. The CheckBoxList control will now display the information from the data source.
You can specify the way the list is displayed by using the RepeatLayout and RepeatDirection properties. If RepeatLayout is set to RepeatLayout.Table (the default setting), the list is rendered within a table. If it is set to RepeatLayout.Flow, the list is rendered without any table structure. By default, RepeatDirection is set to RepeatDirection.Vertical. Setting this property to RepeatDirection.Horizontal renders the list horizontally.
Links
http://msdn.microsoft.com/en-us/library/8bw4x4wa(VS.71).aspx
Revision number 4, Friday, June 27, 2008 9:31:09 PM by
You must Login to comment.
New
Mon, Feb 18, 2008 11:16 PM
by
|
CheckBox
The CheckBox server control accepts Boolean (true or false) input. When selected, its Checked property is true. Typically a check box is processed as one of several fields in a form; however, it can be used to trigger postback to the server if its AutoPostBack
|
Revision #3
Sun, Feb 17, 2008 8:24 AM
by
|
Bind ListControl's DataValueField/TextField to multiple columns
Concept A very common question asked on the ASP.NET Forums is how to bind a ListControl's DataTextField or DataValueField to multiple Columns. The ListControl is the base class for controls such as DropDownList, ListBox, RadioButtonList, and CheckBoxList
|
Revision #17
Tue, Feb 12, 2008 8:02 PM
by
|
Web Controls
Web controls are ASP.NET controls which are understood and compiled on the server and render as HTML markup on the page. Most of the web server controls render their own HTML controls (or many HTML controls). The markup that is output froma web control can
|