Hi Deepak,
Thanks for using Syncfusion products.
We have prepared a simple sample to bind chart with data from JSONResult and ContentResult action methods. The sample can be downloaded from the following link
Query #1: When the number of records exceeds this value (5000) it causes a Internal Server Error inspite of me having a maximum possible value for <jsonSerialization maxJsonLength="2147483644"/> in web.config
We can avoid this limitation by setting the MaxJsonLength value programmatically. Also, MVC application does not consider the jsonSerialization attribute in web.config file if we use Json method to return JsonResult.
Please refer the following code snippet to achieve this
[C#]
[HttpPost]
public JsonResult chart(int intNumberOfRecords)
{
string allText = GetData(intNumberOfRecords);
//Set MaxJsonLength programatically to avoid restriction
return new JsonResult() { MaxJsonLength = Int32.MaxValue, Data = allText };
} |
Query #2: Chart control does not understand ContentResult
We have analyzed your code and found that ContentEncoding property was used instead of ContentType. After making this change, the application works fine.
Please refer the modified code snippet in following table
[C#]
[HttpPost]
public ContentResult chartdata(int intNumberOfRecords)
{
string allText = GetData(intNumberOfRecords);
return new ContentResult() { Content = allText, ContentType = "application/json" };
} |
Please let us know if you have any concern.
Regards,
Anand