ASP.NET MVC Hosting :: How to Use CheckboxList in MVC

MVCCheckBoxList

MVCCheckBoxList is an extension for the MVC HtmlHelper class to create a POSTable checkbox list on a view, based on the data passed from the view model or defined locally.

Features

Earlier, when we need to create the checkbok list in MVC, we loop over the list of data in a model and use a checkbox within that loop.
And get the checked and unchecked data via jQuery or by using similar things.
A MVC CheckBoxlist has given us an easy way to create a checkboxlist without iterating over the list.
It creates POSTable checkboxes with the list provided from the model that is strongly typed with the model bound to the View so we do not need to use loops nor do we need to use jQuery to get the changed data any more.

How to Install

Using Nuget packages we just need to use the following command in the Package Manager Console.
PM> Install-Package MvcCheckBoxList
Step 1: Open Visual Studio and select Tools >> Library Package Manager >> Package Manager Console.

liberary

The Package Manager Console window will appear as in the following:

Package Manager

Step 2: Type the command and hit Enter.

Package Manager Console

And the package is installed and added to your application.

How to use

Step 1: We need a set of data having the text and value .

For example create a class.

 Now create the list of this class in your model.

Now intiate the model to get the data bound to the list of Available Items from the controller.
You can call a method to get the data from the database.
And pass the model to get it bound to the view.

 In the View write syntax as in the following:

No #1 Recommended ASP.NET MVC Hosting

ASPHostPortal.com

ASPHostPortal.com  is the leading provider of Windows hosting and affordable ASP.NET MVC Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability.

HostForLIFE.eu

HostForLIFE.eu guarantees 99.9% uptime for their professional ASP.NET MVC hosting and actually implements the guarantee in practice. HostForLIFE.eu is the service are excellent and the features of the web hosting plan are even greater than many hosting. HostForLIFE.eu offer IT professionals more advanced features and the latest technology. Relibility, Stability and Performance of  servers remain and TOP priority. Even basic service plans are equipped with standard service level agreements for 99.99% uptime. Advanced options raise the bar to 99.99%. HostForLIFE.eu revolutionized hosting with Plesk Control Panel, a Web-based interface that provides customers with 24×7 access to their server and site configuration tools.

DiscountService.com.au

DiscountService.com.au is The Best and Cheap ASP.NET MVC Hosting. DiscountService.com.au was established to cater to an under served market in the hosting industry web hosting for customers who want excellent service. DiscountService.com.au guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability. DiscountService.com.au has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch. DiscountService.com.au is devoted to offering the best Windows hosting solution for you.

Leave a Reply

Your email address will not be published.