Here I will use a JQGrid in ASP.NET Using ASMX Web
Services
(Paging,Sorting,Add/Edit/Del Functions).
The grid is a Ajax-enabled JavaScript control that provides a solution for
representing tabular data on the web. Since the grid is a client-side solution and
loading data dynamically through Ajax callbacks, it can be integrated with any
server side technology.
I found that many are trying to use JQgrid with ASP.NET. Even I tried to
implement JQgrid with basic functionalities like paging, sorting, editing row,
adding row, deleting row by searching in Google.
Finally I created one working example. So I thought I'd share it, thinking that it
may be useful to someone.
Here I am not explaining from the scratch. There are many sources for JQgrid
starters (You can get information about which plugins you need to refer to use JQgrid, basic examples and demos here
http://www.trirand.com/blog/jqgrid/jqgrid.html).
I would like to mention some important things which I found.
I have attached my code.
I have a Table in my database called 'Person' with the structure as below
|
Column Name |
DataType |
|
|
PID |
int |
Primary Key |
|
FirstName |
Nvarchar |
|
|
LastNAme |
Nvarchar |
|
To run the project create the Person table as above and give your DB connection string.
- url: '/WebService.asmx/GetListOfPersons1': This method calls to load data to the grid.
- editurl: '/WebService.asmx/EditRow':This method calls while adding new row,Updating the row and deleting the row.
- Following setting for Add/Edit/Del
operations.
- To post the data to server as object ,have to set content type to "application/json" .
- While deleting row ,grid posts only grid rowid and oper variables.
To a delete row at server side we need some
column values, for example the primary key of the table. To achieve that this setting should be set for the delete operation.
onclickSubmit: function (eparams) {
Manvendra PatelPosted Jan 29, 2015, 5:59 AM
not binding my table data ,please help me
santhosh kumarPosted Dec 12, 2014, 12:46 AM
very good article. it's save lot of time for beginners thank you.
purnachandar raoPosted May 27, 2014, 5:37 AM
hi, How to perform the search operation in this example.How we can implement the server side search.
Amit BaghelPosted Oct 31, 2013, 7:49 AM
Thanx for this article. it helps me alot. But I want jqgrid with wcf. plz post the dome of jqgrid using wcf . please post as soon as possible. Thanx in advance :-)
Satish JadhavPosted Oct 14, 2012, 10:48 AM
Hi there, I downloaded the source code and tried to convert it into VS 2008, but when I execute my application, I get the grid as empty although the same code is working fine in MS VS 2010 (your code). Even the break points in JsonHelper class are not getting hits. Can you please advice?
ab cdPosted Oct 5, 2012, 8:24 AM
thank you ,it works