3

I am using Asp.net Web Forms , earlier I used this jqGrid sample which is not free , this I realized later , now that the confusion was cleared , I will now have to use jqGrid open source thing as I wont opt for commercial one , Can anyone point me to links for getting started with jqGrid and Asp.Net Web Forms , it would be really great if someone gives an example which will show free columns from a sample table in jqGrid , I found some articles online , but couldnot understand how it works. Any suggestions are welcome. Thanks.

Priyank Patel
  • 6,898
  • 11
  • 58
  • 88

1 Answers1

5

I think that working Visual Studio demo projects could help you mostly.

The demo from the answer uses ASHX handler in ASP.NET Web Form application. It uses only free open source package jqGrid which consist from JavaScript code only. The latest version of the source code you can download from github.

Another demo from the answer uses ASHX handler in ASP.NET Web Form application too. It shows how to implement editing of the grid.

I think having both of the demo project you can create application which uses full set of jqGrid features. Moreover the usage of ASHX handler in ASP.NET Web Form define only the way how the client communicate with the server. So you can use any technology which you prefer for the Database access. So You can use either Entity Framework or LINQ to SQL or even more old, but in many cases the best from the performance point of view SqlCommand with SqlDataReader.

It's important to understand that you can get the most part from the code examples created for another technology like ASP.NET MVC (see the example, another one, this one or this one). So you can implement Autocomplete, Export to Excel etc features in the ASHX handler in ASP.NET Web Form solution.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • thank you , will give it a try , the problem with the demo links you gave was , it was a bit difficult for me to understand the use of .ashx in the project , anyways I will try , will it possible for you to just roughly explain the ashx.cs file for a bit of clarity.thanks for your help. – Priyank Patel May 21 '12 at 12:37
  • 1
    @freebird: The first demo is very easy. It consist from `Simple.aspx` page having `
    ` markup and JavaScript code `$("#UsersGrid").jqGrid({url: 'jqGridHandler.ashx', datatype: 'json',...});` which convert the empty table to grid. The page `jqGridHandler.ashx` has the code `jqGridHandler.ashx.cs` where `BuildJQGridResults` will be used to the simple server response. Another method `GetUsers` will be *not used*, but it shows how `BuildJQGridResults` can be changed to use `SqlConnection` instead.
    – Oleg May 21 '12 at 12:47
  • @freebird: You are welcome! If you would get later new questions you can asked there me of cause. – Oleg May 21 '12 at 16:59
  • ya I will , the licensed version had quiet good features , does the open source one offer similar features like complex searching,sorting , showing lakhs of records etc. – Priyank Patel May 21 '12 at 17:08
  • 1
    @freebird: I don't use commercial product jqSuite or other products of http://www.trirand.net/, but I can use all the features which are in your last comment. The difference is mostly that if you use commercial product you can quickly create application using Visual Studio GUI. The code will be generated for you. If you use free product you have to write more JavaScript code, but you will know exactly what your program do. So you should decide what way corresponds more your requirements. – Oleg May 21 '12 at 17:15
  • I implemented the sample example according to my needs , it displays records from my table , how do I enable searching to the same grid , I have posted a question as well http://stackoverflow.com/questions/10698254/how-to-implement-multiple-searching-in-jqgrid , can you guide me thanks. – Priyank Patel May 22 '12 at 08:46
  • @freebird: Do you implemented server side sorting, paging and searching or you implemented sorting and paging only for example and your question is how to implement searching? Which technology you use for the access to the database? – Oleg May 22 '12 at 08:58
  • I used .ashx file to access the database ,ya my question is how do I implement searching.thanks – Priyank Patel May 22 '12 at 09:15
  • @freebird: .ashx file define only how you implement the server side handle, but say nothing about the database access. You are free to use Entity Framework for example or `SqlCommand` which have *absolutely different* implementation of sorting, paging and searching on the server side. – Oleg May 22 '12 at 09:18
  • should I post my .ashx file also? – Priyank Patel May 22 '12 at 09:20
  • @freebird: the `.ashx` file itself contains no helpful information. Its contains is like `<%@ WebHandler Language="C#" CodeBehind="jqGridHandler.ashx.cs" Class="jqGridInWebForm.jqGridHandler" %>`. Helpful information will be in the `.ashx.cs` file (like in `jqGridHandler.ashx.cs` in above example). – Oleg May 22 '12 at 09:25
  • I posted the .cs file in my question ,http://stackoverflow.com/questions/10698254/how-to-implement-multiple-searching-in-jqgrid , please check that – Priyank Patel May 22 '12 at 09:27