小编Spi*_*dey的帖子

错误字符串的长度超过maxJsonLength属性上设置的值

我目前有一个PDF附件网格.每个PDF文件大小可达1MB.问题是我在使用JSON JavaScriptSerializer进行序列化或反序列化时出现错误.字符串的长度超过了maxJsonLength属性上设置的值 "

我已经将以下内容放在web.config中,但问题是它只有在Kendo UI Grid需要显示6条记录时才有效.

<system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength = "2147483647"></jsonSerialization>
      </webServices>
    </scripting>
</system.web.extensions>
Run Code Online (Sandbox Code Playgroud)

json kendo-grid

29
推荐指数
1
解决办法
5万
查看次数

如何刷新Kendo UI网格

我正在尝试刷新Kendo UI网格但尚未成功.有人请告诉我错过了什么或我做错了什么?

我有以下代码:

.cshtml:

 $('#btnRefresh').click(function (e){

            $.ajax({
                type: 'POST',
                url: "@(Url.Content("~/Administration/RefreshAll/"))",

                success: function () {
                    $("#Product").data("kendoGrid").dataSource.read();
                    $('#Product').data('kendoGrid').refresh();
                    //grid.refresh();
                    location.reload(true);
                },
                error: function (){
                    $("#btnRefresh").removeAttr('disabled');
                }
            });


      });
Run Code Online (Sandbox Code Playgroud)

控制器:

public ActionResult RefreshAll([DataSourceRequest] DataSourceRequest request)
        {
            db.ProcessAll();
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            return View();
        }
Run Code Online (Sandbox Code Playgroud)

kendo-ui kendo-grid

15
推荐指数
1
解决办法
4万
查看次数

使用C#(ASP.NET MVC)上传CSV文件

我有一个包含以下内容的CSV文件:

ProductName,EmployeeID,EmployeeName,ContactNo,Adddress
iPad,1233,Tom,89897898,34 Pitt st
iPad,1573,Jack,8978 9689,50 George st
iPad,1893,Peter,8878 8989,32 Martin st 
Run Code Online (Sandbox Code Playgroud)

以下代码将插入到一个表中。我想要实现的是插入2个表中:

产品表(父表)
ProductId(Pk),产品名称

员工表(子表)
EmployeeId(Pk),ProductId(fk),EmployeeName,ContactNo,地址

因此,我基本上需要先将记录插入CSV文件的“产品”表中,然后再插入“雇员”表中。

Controller.cs

[HttpPost]
public ActionResult Index(HttpPostedFileBase FileUpload)
{
    // Set up DataTable place holder 

    Guid ProductId= Guid.NewGuid();
    using (SqlConnection conn = new SqlConnection(connString))
    {
        conn.Open();

        using (SqlCommand cmd = new SqlCommand(
               "INSERT INTO Product VALUES(" + "@ReferralListID,  @ProductName)", conn))
        {
            //Note product name need to read from csv file
            cmd.Parameters.AddWithValue("@ProductId", ProductId);
            cmd.Parameters.AddWithValue("@ProductName", ProductName); 

            int rows = cmd.ExecuteNonQuery();

            //rows number of record got …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc

4
推荐指数
1
解决办法
3万
查看次数

如何返回null guid

我如何在guid中返回null而不是返回Guid.empty.这是代码:

ConsumerID = (subList == null ? Guid.Empty : subList.ConsumerID)
Run Code Online (Sandbox Code Playgroud)

谢谢

c#-4.0

0
推荐指数
1
解决办法
4488
查看次数

标签 统计

kendo-grid ×2

asp.net-mvc ×1

c#-4.0 ×1

json ×1

kendo-ui ×1