0

I'm new at JQGrid. I can bind data to it via codebehind but i don't know how to bind from JQuery could you show me a source which i can learn how to do that ? Thank you

Sercan Ozdemir
  • 4,641
  • 3
  • 34
  • 64
  • 1
    Look at [the answer](http://stackoverflow.com/a/10871428/315935) for example. The demo project with the code described in the answer you can download from [here](http://www.ok-soft-gmbh.com/jqGrid/jqGridASHX.zip). – Oleg May 03 '13 at 09:27
  • Hi, thanks for your quick reply but it's kinda more proffessional tutorial than i expected. I need a more basic tutorial could you help me about it? – Sercan Ozdemir May 03 '13 at 09:31
  • I mean i've got a jQgrid in design and columns with it. How can i populate it via values from javascript. – Sercan Ozdemir May 03 '13 at 09:31
  • If the data will be hold in the database of the backend it would be wrong design to fill the data first in JavaScript objects and then use jqGrid to display it. Moreover you imagine you some special case in which you want use jqGrid, but not explain it. jqGrid support subgrids, TreeGrid (as grid and not as tree of items), grouping of rows, frozen columns and so on. Even if you need "just display simple grid" you could mean local or remote paging, sorting, filtering, searching etc. So there are no universal tutorial (a book) which I can recommend you. – Oleg May 03 '13 at 09:49
  • Hmm, Ok Thanks anyway dude just write it as answer so i can accept. – Sercan Ozdemir May 03 '13 at 11:03

1 Answers1

0

jqGrid have many features and it could be used in many different ways. So it's not enough that you write about a grid. You should specify more what you plan to do, which data you need to display, do you need only display or edit, search, filter, group and so on the data.

There are different strategy how you can provide the data to jqGrid. The most important to know at least approximately imagination about the data which you need to display. For example: do you have hierarchical data or you need just display flat table? Do you need show the user the data which have 30 rows and 5 columns or 100000 rows and 50 columns? Depend on the size of the data you can choose another strategy of the usage of jqGrid. For example one can implement server side paging, sorting and filtering/searching. Alternatively you can implement the same features on the client side. You can provide all data at once and use loadonce: true option. In the case you can write less code on the server side.

If you use for example SqlDataReader to access the data and you see tutorial using Entity Framework then you can not really use the code from such tutorial. Another example, you can provide data for jqGrid per Ajax and implement the server code as ASP.NET MVC controller action or as ASMX web service or as WCF service or as Web API or as ASHX hendler or ... I can continue. There are really many ways of writing ASP.NET code and I am not sure what you do (and what you have to do to corresponds the policy of your corporate). So it's really difficult to answer on your current question. It's too common.

Oleg
  • 220,925
  • 34
  • 403
  • 798