Load data from Webservice (asmx) to jqgrid. Please help me
Solution 1:
You example have a lot of problems. For example
- If you use
[WebMethod, ScriptMethod(ResponseFormat = ResponseFormat.Json)]
attribute on the web method and[ScriptService]
on the the web service class, then the output parameter will be automatically converted to JSON. (see asmx web service, json, javascript/jquery? for example). Then you will not need implementthe functions likeJsonForJqgrid
. - You use very old template for your program. The usage of
datatype
as function for JSON data is no more needed. The usage of very old jqGrid parametersimgpath
andclass="scroll"
in HTML which no more used since many versions of jqGrid show also that you use an very old template for your program. - small errors like
type: "'GET'"
instead oftype: 'GET'
ortype: "GET"
.
If you will follow the way with the usage of datatype
as function you will receive problems if you decide implement data paging of searching in your application.
I recommend you better look at some other examples like jqgrid Page 1 of x pager, jqgrid setGridParam datatype:local or jquery with ASP.NET MVC - calling ajax enabled web service. You can aslo download a working example http://www.ok-soft-gmbh.com/jqGrid/WebServicesPostToJqGrid.zip which I created as a part of the http://www.trirand.com/blog/?page_id=393/help/pager-not-working-for-me-where-am-i-doing-wrong answer or http://www.ok-soft-gmbh.com/jqGrid/VS2008jQueryMVC.zip or http://www.ok-soft-gmbh.com/jqGrid/jQueryMVC.zip (see the another old answer jquery with ASP.NET MVC - calling ajax enabled web service)
UPDATED: You have also the wrong order of the JavaScript files. The ui.multiselect.css
is not loaded as all. You should change it to
Including of jqDnR.js
and jqModal.js
is not needed. It should be a part of jquery.jqGrid.js
if you check the corresponding modules during jqGrid downloading. The jquery.layout.js
are not needed for jqGrid. You should include it only if you use it separately.