by Telerik - Product Type: Component / Add-In / Application / ASP.NET WebForms / ASP.NET AJAX (ATLAS) / .NET WinForms / .NET WPF / Silverlight / AJAX
in Product Suites
Other information on this page is shown for historical reference only and may have changed considerably since.
I am trying to use the self-referencing hierarchy functionality of the grid but not working properly when we have huge data.
We are getting the error as follows,
"Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property."
When i googgled,i got the following code snippet has to be added in the web.config to increase the maxJsonLength property:
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="500000">
</jsonSerialization>
</webServices>
</scripting>
</system.web.extensions>
We also tried to increase the maxJsonLength value. But still getting the same error.
My code:
.aspx page:
<telerik:RadGrid ID="RadGrid1" runat="server" Skin="" Width="97%" GridLines="None"
ShowHeader="False">
<MasterTableView HierarchyDefaultExpanded="True" HierarchyLoadMode="Client" DataKeyNames="ID,ParentScheduleID"
Width="100%" AutoGenerateColumns="False">
<SelfHierarchySettings ParentKeyName="ParentScheduleID" KeyName="ID" MaximumDepth="2" />
<Columns>
<telerik:GridBoundColumn DataField="ScheduleName" HeaderText="ScheduleName" UniqueName="ScheduleName">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
.aspx.cs:(code behind)
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGrid();
}
}
public void BindGrid()
{
DBLayer objDbLayer= new DBLayer();
DataSet dsSchedules = objDbLayer.GetScheduleData(ProjectId);
if (dsSchedules.Tables.Count > 0)
{
RadGrid1.DataSource = dsSchedules.Tables[0];
RadGrid1.DataBind();
}
}
kindly help to resolve this error.
Thanks & Regards,
Venkatraman Gururaj.
Reply
All Infragistics WinForms, WPF, ASP.NET, Silverlight and jQuery controls.
ComponentSource offers a unique global service, used by over 1,000,000 software developers worldwide.