0
這裏是我的網格,其是在MyPartialView:請求的URL沒有返回JSON
@(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?如何解決這個問題?