将初始数据从ASP.NET MVC 4控制器操作方法ast列表传递给initialData

时间:2022-12-02 14:40:10

I have an action result within my Main controller as below:

我的主控制器中有一个动作结果如下:

    public ActionResult Reports()
    {
        List<AModel> aList = _da.GetList();
        return View(aList);
    }

And I want to capture it for knockout in initialData as a list of objects.

我想在initialData中将其作为对象列表捕获。

    //here is the issue I don't know how to pass it.
    var initialData = '@Html.Raw(Json.Encode(Model))';

And I want to bind it like this:

我想像这样绑定它:

     ko.applyBindings(new PagedGridModel(initialData));

Any help thanks.

任何帮助谢谢。

1 个解决方案

#1


1  

Three was another script interfering with this. I will keep you posted once I find out what was causing this.

三是另一个干扰这个的脚本。一旦我发现导致这种情况的原因,我会告诉你。

#1


1  

Three was another script interfering with this. I will keep you posted once I find out what was causing this.

三是另一个干扰这个的脚本。一旦我发现导致这种情况的原因,我会告诉你。