Can't set up server side processing in ASP.NET/C#
Can't set up server side processing in ASP.NET/C#
zavse
Posts: 1Questions: 0Answers: 0
Hello,
I'm rather new to DataTables and have enormous problems setting up server side processing for DataTables on my .aspx page (I'm trying to get data from an .asmx webservice). I've read all the examples I found for server side processing, but still can't get it to work.
If anyone is kind enough to post a simple example (maybe something like this http://datatables.net/release-datatables/examples/server_side/server_side.html) using asp.net/C# possibly with data provided from .asmx webservice, I would much appreciate it.
Thank you very much in advanced,
Danijel
I'm rather new to DataTables and have enormous problems setting up server side processing for DataTables on my .aspx page (I'm trying to get data from an .asmx webservice). I've read all the examples I found for server side processing, but still can't get it to work.
If anyone is kind enough to post a simple example (maybe something like this http://datatables.net/release-datatables/examples/server_side/server_side.html) using asp.net/C# possibly with data provided from .asmx webservice, I would much appreciate it.
Thank you very much in advanced,
Danijel
This discussion has been closed.
Replies
I am looking for good examples too, but no luck. Most the samples are in PHP and not much in Asp.NET webforms. I am having a problem setting up a simple example with a WebService returning the data. I already checked the string (JSON Formatted) from the WebMethod and it is a valid format.
I hope someone can help, otherwise, I will have to give up :(
here is my Default.aspx
In WebService, I have the following Method:
This is my class for the return data, I populate the _data field with individual SystemUser which the method ToString() does the array item inside of square brackets.
The value of sData2 (right above) is like this:
I checked the string value of sData2 in a JSON validator JSONLint and it says that it is okay, however, I keep getting the popup error saying that the
DataTables warning: tableid=tblData - Invalid JSON response
Any ideas... I have a feeling that i am not setting up the JavaScript correctly.
Thanks in advance.
Robert J.
Sorry for the format... it was nice when I wrote it but the Markdown is just weird.
If you are getting an error saying "Invalid JSON" then - that's the problem :-). This tech note (1) provides guidance on how to see exactly what the server is returning.
Allan
Hi Allan,
Strangely, when I intercept the JSON string inside the WebMethod and I save it in a text file and then I modified my page like this:
It works!! Do I have somehow modify my result? LIke I said, I get the result, use a JSON validator and it says that is is fine.
Any ideas? Thanks in advance.
Robert Jurado.
My guess is that you are returning a string that contains valid JSON, rather than just a plain JSON object. However I would need a test case or a debug trace to be able to confirm that.
Allan
Hi Allan,
Thank you, I am hoping that will be helpful. I got the code "ofenah" from the debug trace.
Thank you
Robert J.
That is very certainly not valid JSON that is being returned:
Think you might need to debug your server-side script...
Allan
Hi Allan,
Thanks for this information, it might help me to figure out this problem
Robert J.
Hi Allan,
I just realized that the previous result was on my many different attempts to make this work. This one "eqixax" is how I get a Status code 200. and a "good" result.
Thank you
Robert Jurado
Hi Robert,
Can you please post a simple example (client side and server side code that worked for you) for the rest of us that simply can't get it right? Can you maybe also tell us what was the fix that made it work for you?
Thank you in advanced,
Danijel
Anyone got this right?