In this article I am showing how to show data in a Web Grid in a MVC 4 application using ADO.NET Entity Data Model.
First we need to understand what a Web Grid in MVC is.A WebGrid is used to display data on a web page. The main properties of a WebGrid are:
I will create a new application as in the following:Image 1Image 2Now right-click on Solution Explorer then select Add New Item.Image 3Image 4Image 5Image 6Image 7After clicking Finish right-click on the Model folder then select Add New Item.Image 8Image 9The code inside CRUDOperationsService.cs will look like the following:Image 10Now right-click on the Controller Folder in Solution Explorer then select Add New Controller -> EmployeeAdd a new Action here like in the following image:Image 11Now right-click on GetAllEmployee then select Add New View.Image 12Here we can use a WebGrid as below:Image 13Here we can customize our WebGrid by:
Now run your application:Image 14
Hands on ASP.NET GridView