Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/EmptyTag/156.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# MVC 4,JTTable 2.3,表格数据为';t在第二次(+;)调用时重建_C#_Jquery_Asp.net Mvc_Jquery Ui_Jtable - Fatal编程技术网

C# MVC 4,JTTable 2.3,表格数据为';t在第二次(+;)调用时重建

C# MVC 4,JTTable 2.3,表格数据为';t在第二次(+;)调用时重建,c#,jquery,asp.net-mvc,jquery-ui,jtable,C#,Jquery,Asp.net Mvc,Jquery Ui,Jtable,第一个表上的选择将导致第二个表中的更改。但是,更改只发生一次。任何后续调用都会生成有效的JSON,但html保持不变 控制员: [HttpPost] public JsonResult M1List(int jtStartIndex, int jtPageSize, string jtSorting) { try { List<tblM> m1 = new DataHelper().GetM1(jtSorting

第一个表上的选择将导致第二个表中的更改。但是,更改只发生一次。任何后续调用都会生成有效的JSON,但html保持不变

控制员:

[HttpPost]
    public JsonResult M1List(int jtStartIndex, int jtPageSize, string jtSorting)
    {
        try
        {
            List<tblM> m1 = new DataHelper().GetM1(jtSorting, jtPageSize, jtStartIndex);
            int m1Count = new DataHelper().Getm1Count();

            return Json(new { Result = "OK", Records = m1, TotalRecordCount = m1Count });
        }
        catch (Exception ex)
        {
            return Json(new { Result = "ERROR", Message = ex.Message });
        }
    }

    [HttpPost]
    public JsonResult M2List(int mId, int jtStartIndex, int jtPageSize)
    {
        try
        {
            List<ViewM1A> m2 = new DataHelper().GetM2ForM1(mId.ToString(), "mId", jtPageSize, jtStartIndex);
            int m2Count = new DataHelper().GetM2ForM1Count(mId.ToString());

            return Json(new { Result = "OK", Records = m2, TotalRecordCount = m2Count });
        }
        catch (Exception ex)
        {
            return Json(new { Result = "ERROR", Message = ex.Message });
        }
    }
html:

<div id="m1TC"></div>
<div id="m2TC"></div>

通过在“var record=$(this).data(“record”);”之后添加此代码解决:

$('#m2TC')。删除();
$('#m1TC')。在('')之后;
<div id="m1TC"></div>
<div id="m2TC"></div>
$('#m2TC').remove();
$('#m1TC').after('<div id="m2TC"></div>');