i want to bind jqgrid with static data in asp.net without using webservice. can anybody help me.
A:
Check out this example - http://www.trirand.com/jqgridwiki/doku.php?id=wiki:first_grid
There is not an asynch call to a webservice... just plain old javascript -
colNames:['Inv No','Date', 'Amount','Tax','Total','Notes'],
colModel :[
{name:'invid', index:'invid', width:55},
{name:'invdate', index:'invdate', width:90},
{name:'amount', index:'amount', width:80, align:'right'},
{name:'tax', index:'tax', width:80, align:'right'},
{name:'total', index:'total', width:80, align:'right'},
{name:'note', index:'note', width:150, sortable:false}
],
Kris Krause
2010-07-07 10:54:06
A:
Your problem can be solved in different ways:
- if you use jqGrid 3.7.x you can use new
data
parameter with all values filled. See demo http://trirand.com/blog/jqgrid/jqgrid.html and choose in the tree left "New in version 3.7" and then "Load array data at once". - You can use
addRowData
method (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods) to fill the data. - You can use "json" of "xml" as the
datatype
and "GET" asmtype
parameter. You create a static page like mydata.txt or mydata.xml with the full response which will send typically from the server dynamically, place the file on the web server and use the URL of the page asurl
parameter of jqGrid. I do this typically if I answer to some questions from stackoverflow. See as an example http://www.ok-soft-gmbh.com/jqGrid/DataFetcher.htm or http://www.ok-soft-gmbh.com/jqGrid/Jqgrid37.htm and look at the source of the corresponding pages.
Oleg
2010-07-07 11:14:11