简体   繁体   English

无法将超过1000条记录传递给kendo gridview

[英]Not able to pass more than 1000 records to kendo gridview

I am using Kendo Gridview to display some records. 我正在使用Kendo Gridview显示一些记录。 These records are in Json when retrieved from the database and stored in a list of the same class. 从数据库中检索这些记录并将其存储在同一类的列表中时,这些记录在Json中。 I have no problem when the list is of count 1000, but any number above 1000 triggers an exception : " Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property. " 当列表的数量为1000时,我没有问题,但是大于1000的任何数量都会触发异常:“ 使用JSON JavaScriptSerializer进行序列化或反序列化时出错 。字符串的长度超过了在maxJsonLength属性上设置的值。

I have tried changing the maxJsonLength value in web.config and in appsettings as recommended in some of the solutions I found on stack overflow. 我曾尝试根据我在堆栈溢出时发现的一些解决方案中的建议,更改web.config和appsettings中的maxJsonLength值。 But none of them work. 但是它们都不起作用。 This is my view: 这是我的看法:

@(Html.Kendo().Grid(Model)

.Name("grid")
.Scrollable()
.Filterable()
.Columns(columns =>
    {
        //Columns added here
    })
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
.Pageable(pageable => pageable
.Refresh(false)
.PageSizes(true)
.ButtonCount(3))
.DataSource(dataSource => dataSource
    .Ajax()
    .ServerOperation(false)
    .Model(model =>
        {
            model.Id(p => p.Id);
            model.Field(p => p.Id).Editable(false);

        })
    .Read(read => read.Action("Action", "Controller"))
    .PageSize(50)
    )
.Events(e => e.DataBound("selectDefault"))

I came to realize that the Json Lists that I was passing to the view had too many complex data types(ie class objects and enums) and that was the reason none of the solutions worked. 我意识到,我传递给视图的Json列表具有太多复杂的数据类型(即类对象和枚举),这就是所有解决方案都不起作用的原因。 So I referred to a solution described in this link and created an intermediate view model. 因此,我引用了此链接中描述的解决方案,并创建了一个中间视图模型。 In this model I added all the necessary attributes that I wanted and passed it to view. 在此模型中,我添加了所需的所有必要属性,并将其传递给视图。 It works really fine now 现在真的很好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 超过1000条记录的GridView问题 - GridView issue with more than 1000 records 一次性在SQL Server 2008中插入1000条以上的记录 - Insert more than 1000 records in SQL Server 2008 in one go 我可以从 DirectorySearcher 中获取 1000 多条记录吗? - Can I get more than 1000 records from a DirectorySearcher? 我可以从PrincipalSearcher中获得1000条以上的记录吗? - Can I get more than 1000 records from a PrincipalSearcher? GridView显示多于1000行 - GridView display more then 1000 rows Itext Sharp Report无法为超过37000条记录生成报告 - Itext Sharp Report is not able to generate the Report For more than 37000 records 如何在C#中列出来自Google Drive API V3的1000多条记录 - How to list of more than 1000 records from Google Drive API V3 in C# 查询结果超过1000条记录时,Dapper抛出System.Data.SqlClient.SqlException - System.Data.SqlClient.SqlException Thrown by Dapper When Query Result Has More Than 1000 Records 当多个客户端在同一表中插入超过1000条记录的数组时,数据库锁定问题 - Database locked issue while Inserting in same table the Array of more than 1000 records by multiple client 将pdf页面转换为1000张以上的图像 - Convert pdf pages to images more than 1000
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM