<?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: Dynamic DropDown </title>
	<link>http://www.trirand.com/blog/?page_id=393/discussion/dynamic-dropdown</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/discussion/dynamic-dropdown/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on Dynamic DropDown </title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/dynamic-dropdown#p30094</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/dynamic-dropdown#p30094</guid>
        	        	<description><![CDATA[<p>Hello,</p>
</p>
<p>Your ajax expect json as of the settings.</p>
<p>If you return correct the json string, then the data parameter in the ajax should be a valid JSON object.</p>
<p>You will need not to use eval.</p>
<p>...</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; url: url,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <strong>dataType: "json",</strong><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160; success: function (data)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<strong> countries = data;</strong><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160; &#160; },</p>
<p>....</p>
</p>
<p>Refer to the jQuery json dataTypes.</p>
</p>
<p>Regards</p>
]]></description>
        	        	<pubDate>Wed, 15 Jan 2014 16:39:05 +0200</pubDate>
        </item>
        <item>
        	<title>backy11 on Dynamic DropDown </title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/dynamic-dropdown#p30091</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/dynamic-dropdown#p30091</guid>
        	        	<description><![CDATA[<p>Hello,</p>
</p>
<p>I am using below Ajax call to get data for drop down.&#160; I am not able to return data in the format which dropdowns want</p>
<p>{ &#39;1&#39;: &#39;USA&#39;, &#39;2&#39;: &#39;England&#39; }</p>
<p>// Ajax call</p>
<p>&#160;$.ajax({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; async: false,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; contentType: "application/json; charset=utf-8",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; url: url,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; dataType: "json",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160; success: function (data)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; countries =eval( data);// data.d;//(data);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160; &#160; },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; error: function (XMLHttpRequest, textStatus, errorThrown)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; alert("Error in function, countries: " + XMLHttpRequest.status + "\r\n" + textStatus + "\r\n" + errorThrown);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; });</p>
<p>//ServerSide code</p>
<p>&#160;public object&#160; GetCountries()<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var data = "";<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; List&#60;testData&#62; lstData = new List&#60;testData&#62;();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lstData.Add(new testData { Id = "1", country = "USA" });<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lstData.Add(new testData { Id = "2", country = "England" });<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (int i = 0; i &#60; lstData.Count; i++)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; data = data&#160; +"&#39;" +lstData[i].Id + "&#39;" + ":&#39;" + lstData[i].country+"&#39;" ;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (i != lstData.Count - 1)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; data = data + &#39;,&#39;;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; data = "{" + data + "}";<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return data;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />Above code returns as "{ &#39;1&#39;: &#39;USA&#39;, &#39;2&#39;: &#39;England&#39; }" which is string and not an object.&#160; How&#160;&#160; do I convert "{ &#39;1&#39;: &#39;USA&#39;, &#39;2&#39;: &#39;England&#39; }" to { &#39;1&#39;: &#39;USA&#39;, &#39;2&#39;: &#39;England&#39; } on client side?</p>
]]></description>
        	        	<pubDate>Wed, 15 Jan 2014 16:07:47 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Dynamic DropDown </title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/dynamic-dropdown#p30086</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/dynamic-dropdown#p30086</guid>
        	        	<description><![CDATA[<p>Hello,</p>
</p>
<p>It all depends on how you construct the grid and the function which generates this&#160; "select" string.</p>
<p>Check it.</p>
</p>
<p>Regards</p></p>
]]></description>
        	        	<pubDate>Wed, 15 Jan 2014 15:38:06 +0200</pubDate>
        </item>
        <item>
        	<title>backy11 on Dynamic DropDown </title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/dynamic-dropdown#p30081</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/dynamic-dropdown#p30081</guid>
        	        	<description><![CDATA[<p>Hi All,</p>
</p>
<p>How to construct and return below object from&#160; server side to bind dropdown column in jqgrid, I am using c#&#160; on server side.</p>
</p>
<p>&#160;{ &#39;1&#39;: &#39;USA&#39;, &#39;2&#39;: &#39;England&#39; };</p>
</p>
<p>When&#160; I construct above string at server side and return,&#160; it comes like "{ &#39;1&#39;: &#39;USA&#39;, &#39;2&#39;: &#39;England&#39; }" which it considers as a string and not object&#160; { &#39;1&#39;: &#39;USA&#39;, &#39;2&#39;: &#39;England&#39; } which is without quotation mark.</p>
]]></description>
        	        	<pubDate>Wed, 15 Jan 2014 04:31:49 +0200</pubDate>
        </item>
</channel>
</rss>