- Hosting Article & Tutorial

ASP.NET Tutorial :: How To Run Common CheckBox Operations

In this post, we will explains how to run common operations (like check/uncheck checkboxes by value/text/index, min/max selection limit..etc) on ASP.NET CheckBoxList control using jQuery.

How To Run Common CheckBox Operations in ASP.NET

Step 1

Let’s have following aspx code:

Code on the server side:

Rendered HTML code:

Step 2

How to get value of selected items:

How To Run Common CheckBox Operations 1


How to get index of selected items:

It will display 0 based index of selected items. Suppose we select Item-1,Item-3,Item-4 then It’ll give output 0,2,3 in alert boxes.

How to get text of selection items:

As you’ve seen, Text is placed in label control(next of checkbox) in rendered HTML. So, $(this).next().html() is used to get text.

How to check/uncheck all checkboxes:

How to check items by index:

uppose you have to check items by the given index.

Similarly, you can uncheck items by setting “false” in prop.

How to check items by value:

In this Label text is compared and if text exists then corresponding checkbox is checked. The above code will select Item-1 and Item-3.

How to max selection limit:

The following code limits the number of checkboxes a user can select simultaneously:

How To Run Common CheckBox Operations 2

Similarly, you can implement Min Selection criteria.

Best ASP.NET Hosting with HostForLIFE.eu

HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. They deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. They have customers from around the globe, spread across every continent. They have served the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.

awards-03.pngHostForLIFE.eu is Microsoft No #1 Recommended Windows and ASP.NET Hosting in European Continent. Our service is ranked the highest top #1 spot in several European countries, such as: Germany, Italy, Netherlands, France, Belgium, United Kingdom, Sweden, Finland, Switzerland and many top European countries.

HostForLIFE.eu is the first host to offer its customer all the new features of the ASP.NET 4.6 hosting. You can simply deploy your ASP.NET 4.6 website via their world-class Control Panel or conventional FTP tool. This ASP.NET 4.6 hosting is part of HostForLIFE.eu service and it is provided free of charge.