Showing data in a grid is a basic need of any application. For better user experience, we need sorting, paging, filters, and search functionality in the grid. jqGrid is a very lightweight client side grid, where we can get a lot of functionality easily.
Let us see how we will create a GqGrid and show data in ASP.NET MVC application.
Create a database named Student and create a Table named StudentInfo, as shown below:
Script is shown below to create the table,- USE [Student]
- GO
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE TABLE [dbo].[StudentInfo](
- [StudentId] [int] NOT NULL,
- [Name] [nvarchar](50) NULL,
- [Address] [nvarchar](50) NULL,
- [City] [nvarchar](50) NULL,
- [State] [nvarchar](50) NULL,
- [Country] [nchar](10) NULL,
- [Department] [nchar](10) NULL,
- [Marks] [int] NULL,
- CONSTRAINT [PK_StudentInfo] PRIMARY KEY CLUSTERED
- (
- [StudentId] ASC
- )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
- ) ON [PRIMARY]
- GO
To fetch the data, we will create a simple stored procedure named “GetStudentInfo“, as shown below:
- USE [Student]
- GO
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[GetStudentInfo]
- AS
- BEGIN
- SET NOCOUNT ON;
- SELECT StudentId, Name, Address, City, State,
- Country, Department, Marks from StudentInfo
- END
For test purposes, execute the stored procedure and you will get the output, as shown below:
Now our database is ready to use.
Now we will create a simple ASP.NET MVC Web Application. Go to Visual Studio and create a new project.

Select MVC and click OK.

Now our project is created.
In the next step, we will use the Entity framework, which will call the above stored procedure to retrieve the data from the StudentInfo table.
For using Entity framework, we will create an Edmx, as shown below. Go to the project, add new Item, go to the data section and select “ADO.NET Entity Data Model”.
In the next step, select Generate from database.
Now, we will be able to see student entities that are created.

In the next step, we will get the jqGrid related file from the Nuget.
Download the Jquery.JQGrid from the Nuget package, as shown below:
We will get the required scripts for JqGrid from Nuget.
Now, we know that we have HomeController and we have the Index action, which returns the Index view.
We will call a different action, when the Index view is loaded.


Rohan LaghatePosted Nov 4, 2016, 8:14 AM
Good Work ! However, sorting and search functionality is not working ..What am I missing? I followed the same steps mentioned above.
Manav PandyaPosted Oct 9, 2016, 3:19 AM
Thanks sir ...
Mikhail TatskyPosted Aug 30, 2016, 3:52 PM
It would be cool to read the same article
Santhakumar MunuswamyPosted Jun 25, 2016, 3:08 AM
Nice share
DyansmithPosted Jun 15, 2016, 11:56 PM
Useful & Nice article with all required steps , Thanks for your effort.
Bhavik PatelPosted Jun 15, 2016, 10:22 PM
good sharing
Kuppurasu NagarajPosted Jun 14, 2016, 1:13 PM
Nice Sharing..
Vignesh ManiPosted Jun 14, 2016, 11:58 AM
Nice one
Raviteja SwayampuPosted Jun 14, 2016, 8:42 AM
Check this site for more applications like that www.mitechdev.com
Thiruppathi RPosted Jun 14, 2016, 4:17 AM
Nice..
kalu singh raoPosted Jun 14, 2016, 1:44 AM
Nice Articles
RajaPosted Jun 14, 2016, 12:03 AM
Good One...
Debasis SahaPosted Jun 13, 2016, 1:41 PM
Nice One..