请求的URL未返回Json

时间:2012-05-08 15:36:39

标签: asp.net-mvc json partial-views

这是MyPartialView中的网格:

@(Html.Telerik().Grid<MyClass>()
        .Name("GridMyClass")
        .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.BareImage))
            .DataKeys(keys => keys.Add(a => a.Id))
                    .ClientEvents(events => events.OnError("Grid_onError"))
        .Columns(columns =>
        {
            columns.Bound(p => p.Name).Width(110);
            columns.Bound(p => p.Timestamp).Width(110).Format("{0:MM/dd/yyyy}");
            columns.Command(commands =>
            {
                commands.Edit().ButtonType(GridButtonType.BareImage);
                commands.Delete().ButtonType(GridButtonType.BareImage);
            }).Width(180).Title("Edit");
        })
        .DataBinding(dataBinding =>
        {
            dataBinding.Ajax()
            .Select("Ge", "MyClass")
            .Update("Edit", "MyClass")
            .Delete("Delete", "MyClass")
            .Insert("Insert", "MyClass");
        })
    .Pageable()
    .Sortable()
    //.Scrollable()
    //.Groupable()
    //.Filterable()
    //.Editable(editing => editing.Mode(GridEditMode.InLine))

这是控制器方法之一(其他类似):

public ActionResult Delete()
    {
        //delete

        //get the model

        List<MyClassTemplate> ct = new List<MyClassTemplate>();
        //fill ct
        return PartialView("MyPartialView", new GridModel<MyClassTemplate> { Data = ct });
    }

另一种控制器方法:

public ActionResult MyPartialView()
    {
        List<MyClassTemplate> ct = new List<MyClassTemplate>();
        //fill ct 
        return PartialView(ct);//new GridModel(ct)
    }

当我在网格中编辑一行并单击图像以保存编辑的行时,我将通过控制器方法逐步使用断点。一切都好。 ct有价值。但是,我得到警告“错误!请求的URL没有返回Json。”。哪个网址没有返回json?如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

错误非常明显。我应该返回json而不是局部视图。