Skip to main content

Posts

Showing posts with the label checkboxlist

CheckBoxList SelectedIndexChanged event in asp.net c#

CheckBoxList SelectedIndexChanged Event Asp.net CheckBoxList web server control provides a multi-selection checkbox group. this is a list server control. list server control contains an Items collection that holds all ListItem Objects. ListItem objects have three useful properties they are Text, Value, and Selected. CheckBoxList control's OnSelectedIndexChanged property raises the SelectedIndexChanged event. this property allows the developers to write a custom handler for the SelectedIndexChanged event. The SelectedIndexChanged event is raised when the selection from the CheckBoxList control changes between posts to the server. so when a user changes a selection from CheckBoxList control then the SelectedIndexChanged event is raised and the page automatically posts to the web server. for that happening developers need to set the CheckBoxList AutoPostBack property value to True. when someone changes the selection from CheckBoxList then th...

How to use AutoPostBack in asp.net c# CheckBoxList

AutoPostBack feature in CheckBoxList CheckBoxList is an ASP.NET web server control. This server control creates a multi-selection CheckBox group. CheckBoxList can be dynamically populated by binding the data source. CheckBoxList AutoPostBack property gets or sets a value indicating whether a postback to the server automatically occurs when the user changes the CheckBoxList selection. This property value type is a Boolean. If we set the property value to true then a postback automatically occurs when the user changes the CheckBoxList selection. And if we set this property value to false then automatic postback to the server will be disabled. The default value of this property is false. CheckBoxList SelectedIndexChanged event occurs when the selection of CheckBoxList changes between posts to the server. to work this event properly we need to set the CheckBoxList AutoPostBack property value to true. The following ASP.NET C# example co...

asp.net - How to DataBind a CheckBoxList with an array

DataBind a CheckBoxList with array The following ASP.NET C# example code demonstrates to us how can we data bind a CheckBoxList web server control programmatically at run time with an Array data source object. CheckBoxList is an ASP.NET list web server control. CheckBoxList allows web users to select/check one or more items at a time. CheckBoxList contains ListItem objects. Each ListItem object represents an item. We can populate a CheckBoxList from Array elements. To do this, first, we need to initialize an array object. Then we populate the Array with items (elements). Next, we need to specify the newly created Array as CheckBoxList control's DataSource. Finally, we can data bind CheckBoxList control with Array by calling the CheckBoxList DataBind() method. The populated CheckBoxlist creates the same number of items as the number of elements that exist in the Array. Each Array element creates an item in CheckBoxList. We populated CheckBoxL...

Get CheckBoxList selected items using foreach loop in asp.net c#

Get CheckBoxList selected items using foreach loop The following ASP.NET C# example code demonstrates to us how can we loop through the CheckBoxList items and can get the selected item's text and value. CheckBoxList is an asp.net list web server control. Web users are allowed to select/check one or more items from the CheckBoxList control at a time. CheckBoxList can be empty or can contain one or more items as presented like CheckBox. We can get CheckBoxList checked/selected items programmatically at run time by using both for loop and foreach loop. In this tutorial, we will see how can we get CheckBoxList selected items by using the foreach loop. The .NET framework's foreach loop allows us to iterate through all items in an item collection. The foreach loop iterates through the items/elements by following the item's index. Because CheckBoxList items are contained in an items collection, we can loop through the items. To get Check...

How to populate a CheckBoxList from SqlDataSource in asp.net c#

Populate a CheckBoxList from SqlDataSource CheckBoxList is an asp.net web server control that provides a multi-selection CheckBox group. CheckBoxList control support data binding. so we can populate CheckBoxList with items from a data source control. To bind CheckBoxList control to a data source, first, asp.net developers need to create a data source control such as ObjectDataSource, LinqDataSource, SqlDataSource control, etc. DataSource control contains the items to display in the CheckBoxList. After creating the DataSource control, developers can call the CheckBoxList DataBind method to bind the DataSource to the CheckBoxList control. This method allows developers to programmatically (dynamically) data bind CheckBoxList control at run time. CheckBoxList control's DataTextFiled and DataValueFiled properties specify which field in the data source to bind to the Text and Value properties of each list item in CheckBoxList control. ChecBox...