This is a migrated thread and some comments may be shown as answers.

Json error

5 Answers 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeff Tang
Top achievements
Rank 1
Jeff Tang asked on 21 Nov 2008, 03:21 AM
Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

I encounter the above error when loading a lot of data into the Grid( aound 17000 rows), but it is ok for loading 12000 rows. I am using grid1.DataSource = dtTable; to bind the data. How can I solve this problem

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 21 Nov 2008, 07:16 AM
Hello Jeff,

Please check this article for more info:
http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.maxjsonlength.aspx

Sincerely yours,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jeff Tang
Top achievements
Rank 1
answered on 22 Nov 2008, 02:21 AM
The problem still exist after I set the MaxJsonLength to Int32.MaxValue
0
Vlad
Telerik team
answered on 24 Nov 2008, 08:44 AM
Hello Jeff,

I just tried RadGrid with 20000 records and 10 columns at once with no paging however didn't get any exception. You can find small project attached.

Can you post your grid declaration?

Kind regards,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jeff Tang
Top achievements
Rank 1
answered on 25 Nov 2008, 01:36 AM

 <telerik:RadGrid ID="rgAfftAdd" runat="server" AutoGenerateColumns="False"
                                               GridLines="None" Skin="WebBlue" Width="100%" BorderStyle="Solid"
                                               BorderColor="#3399FF" BorderWidth="1px"
                                               AllowMultiRowSelection="True" AllowSorting="True">
                                                 
                                        <SelectedItemStyle BackColor="#99CCFF" />      
                                     
                                        <ClientSettings>
                                               <Selecting AllowRowSelect="True" />
                                               <ClientEvents OnRowDblClick="Row_Select" OnRowClick ="Row_Single_Click" />                               
                                               <Scrolling AllowScroll="True"></Scrolling> 
                                        </ClientSettings>   

                                        <MasterTableView Font-Bold="False" Font-Italic="False" Font-Overline="False"
                                                         Font-Strikeout="False" Font-Underline="False" PageSize="2000"
                                                        
                                            ClientDataKeyNames="TYPE, START_TIME, ADDR, SP_CUST, REC_NO, lid, ln_sub_no"
                                            Width="98%">
                                                          
                                                <RowIndicatorColumn>
                                                    <HeaderStyle Width="20px"></HeaderStyle>
                                                </RowIndicatorColumn>

                                                <ExpandCollapseColumn>
                                                    <HeaderStyle Width="20px"></HeaderStyle>
                                                </ExpandCollapseColumn>
                                           
                                                <Columns>
                                                    <telerik:GridBoundColumn DataField="TYPE" HeaderText="Type" UniqueName="TYPE">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="START_TIME" DataType="System.DateTime"
                                                                             HeaderText="Start Time" UniqueName="START_TIME"
                                                                             DataFormatString="{0:dd/MM/yyyy HH:mm:ss}">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="ADDR" HeaderText="Address" UniqueName="ADDR">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="SP_CUST" HeaderText="Sp. Cust."
                                                                             UniqueName="SP_CUST" Aggregate="Count" ReadOnly="True">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="REC_NO" HeaderText="Rec_No" UniqueName="REC_NO" Visible = "false">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="lid" UniqueName="lid" Visible = "false" >
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="ln_sub_no" UniqueName="ln_sub_no" Visible = "false">
                                                    </telerik:GridBoundColumn>
                                                </Columns>
                                               
                                                <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                                <HeaderStyle Font-Bold="True" Font-Italic="False" Font-Overline="False"
                                                             Font-Strikeout="False" Font-Underline="False" ForeColor="Black" Wrap="True" />       
                                        </MasterTableView>                   

                                        <FilterMenu EnableTheming="True" Skin="WebBlue">
                                            <CollapseAnimation Duration="200" Type="OutQuint" />
                                        </FilterMenu>

                                </telerik:RadGrid>

 

 

and I have try to follow your code to assign the datatable to the grid, but it turn out the same error. I find that the problem exists if it existis around 15000 rows. And the datatable I used is get from a Session variable, that is I have a page for searching and assign the result datatable to a Session variable, then I redirect to another page show the grid.

0
Sebastian
Telerik team
answered on 25 Nov 2008, 09:26 AM

Hello Jeff,

Unfortunately we are still not able to recreate the issue locally. Can you please check whether storing the data table with large number of rows in a Cache object instead of the Session eliminates the error you receive? Also verify that you are using the latest version 2008.3.1105 of RadControls for ASP.NET AJAX.

If the problem persists, please isolate a working subset of your project and send it enclosed to a regular support ticket. We will test/debug it locally and will get back to you with our findings.

Kind regards,

Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Jeff Tang
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Jeff Tang
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or