<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: ASP.NET WebService - How to load grid from...</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>OlegK on ASP.NET WebService - How to load grid from...</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from#p18382</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from#p18382</guid>
        	        	<description><![CDATA[<p>Hi Jeff!</p>
<p>Like promised&#160;<span style="font-size: 13.8889px;">you code example in UPDATED parts of&#160;<a href="http://stackoverflow.com/questions/3169408/jqgrid-setgridparam-datatypelocal/3170652#3170652&#160;and&#160;http://stackoverflow.com/questions/3161302/jqgrid-page-1-of-x-pager/3161542#3161542" rel="nofollow" target="_blank"><a href="http://stackoverflow.com/quest" rel="nofollow">http://stackoverflow.com/quest</a>.....42#3161542</a>.</span></p>
<p><span style="font-size: 13.8889px;"> I hope it will solve all your problem.</span></p>
<p>Best regards<br />Oleg&#160;</p>
]]></description>
        	        	<pubDate>Sun, 04 Jul 2010 03:28:02 +0300</pubDate>
        </item>
        <item>
        	<title>JeffV on ASP.NET WebService - How to load grid from...</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from#p18378</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from#p18378</guid>
        	        	<description><![CDATA[<p style="padding-left: 30px;">jQuery(document).ready(function () {</p>
<p style="padding-left: 60px;">jQuery("#list").jqGrid({</p>
<p style="padding-left: 60px;">datatype: processrequest,</p>
<p style="padding-left: 60px;">mtype: &#39;POST&#39;,</p>
<p style="padding-left: 60px;">jsonReader: {</p>
<p style="padding-left: 60px;">root: "rows", //arry containing actual data</p>
<p style="padding-left: 60px;">page: "page", //current page</p>
<p style="padding-left: 60px;">total: "total", //total pages for the query</p>
<p style="padding-left: 60px;">records: "records", //total number of records</p>
<p style="padding-left: 60px;">repeatitems: false,</p>
<p style="padding-left: 60px;">id: "ID" //index of the column with the PK in it</p>
<p style="padding-left: 60px;">},</p>
<p style="padding-left: 60px;">colNames: [&#39;Name&#39;, &#39;Title&#39;],</p>
<p style="padding-left: 60px;">colModel: [</p>
<p style="padding-left: 60px;">{ name: &#39;name&#39;, index: &#39;name&#39;, width: 250 },</p>
<p style="padding-left: 60px;">{ name: &#39;title&#39;, index: &#39;title&#39;, width: 250 }</p>
<p style="padding-left: 60px;">],</p>
<p style="padding-left: 60px;">pager: &#39;#pager&#39;,</p>
<p style="padding-left: 60px;">rowNum: 10,</p>
<p style="padding-left: 60px;">rowList: [10, 20, 30],</p>
<p style="padding-left: 60px;">sortorder: "desc",</p>
<p style="padding-left: 60px;">viewrecords: true,</p>
<p style="padding-left: 60px;">height: &#39;250px&#39;,</p>
<p style="padding-left: 60px;">caption: &#39;My first grid&#39;</p>
<p style="padding-left: 60px;">}).navGrid(&#39;#pager&#39;, {edit: false, add: false, del: false});</p>
<p style="padding-left: 30px;">});</p>
<p style="padding-left: 30px;">&#160;</p>
<p style="padding-left: 30px;">&#160;</p>
<p style="padding-left: 30px;">function processrequest(postdata) {</p>
<p style="padding-left: 60px;">//    alert(postdata._search);</p>
<p style="padding-left: 60px;">//    alert(postdata.searchString);</p>
<p style="padding-left: 60px;">$(".loading").show();</p>
<p style="padding-left: 60px;">$.ajax({</p>
<p style="padding-left: 60px;">type: "POST",</p>
<p style="padding-left: 60px;">data: "{}",</p>
<p style="padding-left: 60px;">datatype: "json",</p>
<p style="padding-left: 60px;">url: "../webServices/myTestWS.asmx/testMethod",</p>
<p style="padding-left: 60px;">contentType: "application/json; charset-utf-8&#8243;,</p>
<p style="padding-left: 90px;">complete: function (jsondata, stat) {</p>
<p style="padding-left: 120px;">if (stat == "success") {</p>
<p style="padding-left: 120px;">var thegrid = jQuery("#list")[0];</p>
<p style="padding-left: 120px;">var jsonObject = (eval("(" + jsondata.responseText + ")"));</p>
<p style="padding-left: 120px;">thegrid.addJSONData(jsonObject.d);</p>
<p style="padding-left: 120px;">$(".loading").hide();</p>
<p style="padding-left: 120px;">} else {</p>
<p style="padding-left: 120px;">$(".loading").hide();</p>
<p style="padding-left: 120px;">alert("Error with AJAX callback");</p>
<p style="padding-left: 120px;">}</p>
<p style="padding-left: 90px;">}</p>
<p style="padding-left: 60px;">});</p>
<p style="padding-left: 30px;">}</p>
]]></description>
        	        	<pubDate>Fri, 02 Jul 2010 23:11:42 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on ASP.NET WebService - How to load grid from...</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from#p18373</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from#p18373</guid>
        	        	<description><![CDATA[<p>You makes all too complex. jqGrid can do ajax request you you and you don&#39;t really need use <strong>eval</strong> and <strong>addJSONData</strong> method. You use probably some code example created for a very old verion of jqGrid. Now you can use all with using the corresponding jqGrid parameters. If you post a code example (here on stackoverflow or both) I could show how it could be improoved.</p>
]]></description>
        	        	<pubDate>Fri, 02 Jul 2010 12:28:44 +0300</pubDate>
        </item>
        <item>
        	<title>JeffV on ASP.NET WebService - How to load grid from...</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from#p18362</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from#p18362</guid>
        	        	<description><![CDATA[<p>I actually got it to work&#8230;</p>
</p>
<p>My scenario was very simple as I wanted to see how it worked in the easiest form before I ramped it up into something more complicated. &#160;</p>
</p>
<p>First my object&#160;that my webservice returned had to have the following properties (or some variation):</p>
<p>Private _total As Integer</p>
<p>Private _records As Integer</p>
<p>Private _page As Integer</p>
<p>Private _rows As List(of names)</p>
</p>
<p>The second key was my webservice. &#160;I added the following to my ASP.Net webservice:</p>
<p>&#60;ScriptMethod(ResponseFormat:=ResponseFormat.Json)&#62; _</p>
<p>&#60;WebMethod()&#62; _</p>
</p>
<p>The JSON data that was returned finally looked correct:</p>
<div class="netInfoResponseText  netInfoText ">
<pre><span style="font-family: monospace;">{"d":{"__type":"myJQueryTestBed.myTest",</span></pre>
<pre><span style="font-family: monospace;">"total":2,"records":2,"page":1,</span></pre>
<pre><span style="font-family: monospace;">"rows":[{"name":"Jeff","title":"Programmer"},{"name":"Steve","title":"Programmer"}]}}</span></pre>
</div>
<p>Lastly my jQuery code needed the following:</p>
<p>jsonReader: {</p>
<p>root: "rows", //arry containing actual data</p>
<p>page: "page", //current page</p>
<p>total: "total", //total pages for the query</p>
<p>records: "records", //total number of records</p>
<p>repeatitems: false,</p>
<p>id: "ID" //index of the column with the PK in it</p>
<p>},</p>
</p>
<p>To be honest I&#39;m still trying to figure this part out for the paging functionality but this is what worked for me in my VERY simple code example.</p>
</p>
<p>Also this is my call using the addJSONData:</p>
<p>var thegrid = jQuery("#list")[0];</p>
<p>var jsonObject = (eval("(" + jsondata.responseText + ")"));</p>
<p>thegrid.addJSONData(jsonObject.d);</p>
<p>If you need all the code to get this very simple example to work message me and I will copy everything for you. &#160;I can guarantee that ASP.NET and jqGrid does work. &#160;There are just a couple of flaming hoops you have to jump through to get there initially. &#160;I will say that it was really easy to ramp up my code to a much more complicated set of data once I had figured out this simple example.</p></p>
]]></description>
        	        	<pubDate>Thu, 01 Jul 2010 19:28:54 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on ASP.NET WebService - How to load grid from...</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from#p18353</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from#p18353</guid>
        	        	<description><![CDATA[<p>The problem is already solved. See <a href="http://stackoverflow.com/questions/3151565/can-you-use-jqgrid-within-asp-net-using-a-webservice-and-javascript/3151997#3151997&#160;for" rel="nofollow" target="_blank"><a href="http://stackoverflow.com/quest" rel="nofollow">http://stackoverflow.com/quest</a>.....7&#160;for</a> details.</p>
]]></description>
        	        	<pubDate>Thu, 01 Jul 2010 14:00:06 +0300</pubDate>
        </item>
        <item>
        	<title>michaelg on ASP.NET WebService - How to load grid from...</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from#p18338</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from#p18338</guid>
        	        	<description><![CDATA[<p>Hi There,</p>
</p>
<p>I think that you need to set dataType to "json" (rather than "local") in your ajax call.</p>
<p>Other than that, perhaps the url ...</p>
</p>
<pre></pre>
<pre>../webServices/myTestWS.asmx/testMethod</pre>
<p>... is incorrect (ie. using ../ at the front might not be finding it correctly).&#160; I hope that helps</p>
</p>
<p>Cheers,</p>
<p>Michael</p>
]]></description>
        	        	<pubDate>Thu, 01 Jul 2010 02:12:34 +0300</pubDate>
        </item>
        <item>
        	<title>Nathan on ASP.NET WebService - How to load grid from...</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from#p18331</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from#p18331</guid>
        	        	<description><![CDATA[<p>Hi Jeff,</p>
</p>
<p>I&#39;ve been battling this problem for a few weeks now.&#160; I still haven&#39;t resolved the problem at hand and have tried just about everything I can think of. If you get this working please let me know how you did so and if I determine the issue I&#39;ll let you know asap.</p>
</p>
<p>Nathan</p>
]]></description>
        	        	<pubDate>Wed, 30 Jun 2010 21:08:48 +0300</pubDate>
        </item>
        <item>
        	<title>JeffV on ASP.NET WebService - How to load grid from...</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from#p18325</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/asp-net-webservice-how-to-load-grid-from#p18325</guid>
        	        	<description><![CDATA[<p>All I am just trying to figure this out with a very simple set of data:</p>
</p>
<pre><p><input type='button' class='sfcodeselect' name='sfselectit9112' value='Select Code' data-codeid='sfcode9112' /></p><div class='sfcode' id='sfcode9112'>{&#34;d&#34;:&#34;name: Jeff V title: Programmer&#34;}<br /><br />I want to load the grid using this JSON data.<br /><br />I have tried many different ways and examples to load this <br />into the grid but I have had 0 luck.<br />Here is my code:<br /><pre><br /><p>jQuery(document).ready(function () {</p>
<p>jQuery(&#34;#list&#34;).jqGrid({</p>
<p>datatype: processrequest,</p>
<p>mtype: &#39;POST&#39;,</p>
<p>colNames: [&#39;Name&#39;, &#39;Title&#39;],</p>
<p>colModel: [</p>
<p>{ name: &#39;name&#39;, index: &#39;name&#39;, width: 55 },</p>
<p>{ name: &#39;title&#39;, index: &#39;title&#39;, width: 90 }</p>
<p>],</p>
<p>pager: jQuery(&#39;#pager&#39;),</p>
<p>rowNum: 10,</p>
<p>rowList: [10, 20, 30],</p>
<p>sortname: &#39;id&#39;,</p>
<p>sortorder: &#34;desc&#34;,</p>
<p>viewrecords: true,</p>
<p>imgpath: &#39;themes/basic/images&#39;,</p>
<p>caption: &#39;My first grid&#39;</p>
<p>});</p>
<p>});</p>
<br />
<br />
<p>function processrequest(postdata) {</p>
<p>$(&#34;.loading&#34;).show();</p>
<p>$.ajax({</p>
<p>type: &#34;POST&#34;,</p>
<p>data: &#34;{}&#34;,</p>
<p>dataType: &#34;local&#34;,</p>
<p>url: &#34;../webServices/myTestWS.asmx/testMethod&#34;,</p>
<p>contentType: &#34;application/json; charset-utf-8&#34;,</p>
<p>complete: function (jsondata, stat) {</p>
<p>if (stat == &#34;success&#34;) {</p>
<p>var thegrid = jQuery(&#34;#list&#34;)[0];</p>
<p>thegrid.addJSONData(eval(&#34;(&#34; + jsondata.responseText + &#34;).d&#34;));</p>
<p>$(&#34;.loading&#34;).hide();</p>
<p>} else {</p>
<p>$(&#34;.loading&#34;).hide();</p>
<p>alert(&#34;Error with AJAX callback&#34;);</p>
<p>}</p>
<p>}</p>
<p>});</p>
<p>}</p><br /><br />Any help is appreciated!  Thanks</pre>
</div>
]]></description>
        	        	<pubDate>Wed, 30 Jun 2010 18:21:16 +0300</pubDate>
        </item>
</channel>
</rss>