Clear CheckBoxList in one line

Does anyone know how to clear a CheckBoxList in one line?

I have a CheckBoxList that holds hundreds of values and I'm just trying to speed up the code.

i.e. without iterating through each checkbox like so:

foreach (ListItem li in cblCategories.Items)
        { li.Selected = false; }

I know this isn't going to make a huge difference to the user experience - I'm just curious if anyone knows a more efficient way of doing this? I was hoping for something like:

cblCategories.Items.Selected = none;

Answers


The ClearSelection method, which it inherits from the ListControl class.


Need Your Help

javascript not working with hiddenfield

javascript asp.net .net

i want to find hiddenfield in my javascript but it is showing undefined value.

500 Error on apache server - “AllowOverride not allowed here”

php osx apache .htaccess httpd.conf

I have set up a server on my Mac (OSX 10.9) but it's returning a 500 error with the following message in the error log…

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.