Title: How to request the json data from an IIS server using .Net Post by: jimprucha on December 13, 2011, 11:35:29 AM Hi,
I see plenty of examples of loading the json data through a static file. How do we load the datagrid if we need to make a call to the server to get the json data? An example using jQuery would be great? Thanks, Jim Title: Re: How to request the json data from an IIS server using .Net Post by: mzeddd on December 14, 2011, 07:34:50 AM In my PHP code it looks like this:
Code: $(function(){ AND Code: <?php For .NET should be smth similar Check this: http://pietschsoft.com/post/2008/02/NET-35-JSON-Serialization-using-the-DataContractJsonSerializer.aspx (http://pietschsoft.com/post/2008/02/NET-35-JSON-Serialization-using-the-DataContractJsonSerializer.aspx) Title: Re: How to request the json data from an IIS server using .Net Post by: jimprucha on December 14, 2011, 09:18:25 AM Here is my code in the aspx page. It is getting to it as I can see in the log file that it gets the JSON data and I validated it.
Code: string jsonString = new JavaScriptSerializer().Serialize(fields); Here is the code to call the datagrid: Code: var frozenColumns = "[[{field:'MappingFieldID',title:'MappingFieldID',width:100,align:'center'},{field:'Field',title:'Field',width:100,align:'left'}]]"; Any ideas if this is the correct way to load the JSON data from a .net page? I also have another way using a webmethod to get the JSON data but how if I have the JSON data could I load it into the datagrid?? Any help either way would be great!! Thanks, Jim Title: Re: How to request the json data from an IIS server using .Net Post by: frapa02 on January 06, 2012, 04:27:23 AM I would try to debug with the browser, e.g. Firefox and Firebug, then monitor the http buffers where you can check the response from your server program and that it is the same as in your log. Your server code just needs to print the json string so I am not sure that you should have the Request.ContentType in there since you are not asking the browser to handle this, just ajax.
It might also be worth checking your IIS logs. Paul. Title: Re: How to request the json data from an IIS server using .Net Post by: pacific202 on January 11, 2012, 06:49:36 PM I'll second the recommendation for using another browser to debug. The tools that are built into Chrome are amazing for helping to debug this kind of thing.
The easy way to see what's going on is just to drop the url into your address bar. What does GetJSONData.aspx return? You could also put custom code into the onLoadError event for the DataGrid. |