telerik grid Microsoft JScript 运行时错误:“i.validator”编辑时为空或不是对象错误
我已将 MVC 扩展升级到 MVC Q3 2011(版本 2011.3.1115.340)。我有一个使用 ajax 编辑内联模式的 Telerik 网格。网格显示正确,但当我尝试编辑一行时,它给出 Microsoft JScript 运行时错误:“i.validator”为 null 或不是 telerik.grid.editing.min.js 文件中的对象。下面是我的代码:
<div id="addEditSelectionTable">
<% Html.Telerik().Grid(Model.InnerModel.SelectionsList)
.Name("Grid")
.ToolBar(commands => commands.Insert())
.DataKeys(keys => keys.Add(o => o.SelectionID))
.DataBinding(dataBinding =>
{
dataBinding.Ajax()
.Select("_SelectAjaxEditing", "Grid")
.Insert("_InsertAjaxEditing", "Grid")
.Update("_SaveAjaxEditing", "Grid")
.Delete("_DeleteAjaxEditing", "Grid");
})
.Columns(columns =>
{
columns.Bound(o => o.SelectionID);
columns.Bound(o => o.Enabled);
columns.Bound(o => o.SelectionType);
columns.Bound(o => o.Frequency);
columns.Command(commands =>
{
commands.Edit();
commands.Delete();
}).Width(200);
})
.Scrollable(s => s.Enabled(true))
.Scrollable(scrolling => scrolling.Height(500))
.Resizable(resize => resize.Columns(true))
.Reorderable(reorder => reorder.Columns(true))
.Footer(false)
.Render();
%>
</div>
我的控制器有 GridAction :
[AcceptVerbs(HttpVerbs.Post)]
[GridAction]
public ActionResult _SaveAjaxEditing(int id)
{
var sModel = SamplesModel.GetAllSampleSelections();
return View(new GridModel(sModel.SelectionsList));
}
不知道为什么会发生这种情况。网格无需编辑即可正常工作。
I have upgraded MVC extensions to MVC Q3 2011(version 2011.3.1115.340). I have a telerik grid using ajax editing inline mode. Grid displays correctly but when I try to edit a row, it gives
Microsoft JScript runtime error: 'i.validator' is null or not an object in telerik.grid.editing.min.js file. Below is my code:
<div id="addEditSelectionTable">
<% Html.Telerik().Grid(Model.InnerModel.SelectionsList)
.Name("Grid")
.ToolBar(commands => commands.Insert())
.DataKeys(keys => keys.Add(o => o.SelectionID))
.DataBinding(dataBinding =>
{
dataBinding.Ajax()
.Select("_SelectAjaxEditing", "Grid")
.Insert("_InsertAjaxEditing", "Grid")
.Update("_SaveAjaxEditing", "Grid")
.Delete("_DeleteAjaxEditing", "Grid");
})
.Columns(columns =>
{
columns.Bound(o => o.SelectionID);
columns.Bound(o => o.Enabled);
columns.Bound(o => o.SelectionType);
columns.Bound(o => o.Frequency);
columns.Command(commands =>
{
commands.Edit();
commands.Delete();
}).Width(200);
})
.Scrollable(s => s.Enabled(true))
.Scrollable(scrolling => scrolling.Height(500))
.Resizable(resize => resize.Columns(true))
.Reorderable(reorder => reorder.Columns(true))
.Footer(false)
.Render();
%>
</div>
My controller has GridAction :
[AcceptVerbs(HttpVerbs.Post)]
[GridAction]
public ActionResult _SaveAjaxEditing(int id)
{
var sModel = SamplesModel.GetAllSampleSelections();
return View(new GridModel(sModel.SelectionsList));
}
No clue why this might be hapening. grid works fine without editing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我有同样的问题。我的原因是我的可编辑网格位于模式对话框上,并且我认为 Telerik 在对话框上而不是在普通页面上渲染网格时不会创建验证器对象。
我还在主页上有一个不可编辑的网格来触发对话框。我所做的是将“Editable(editing => Editing.Mode(GridEditMode.InLine)”属性附加到主网格以假装它是可编辑的(但不渲染任何命令按钮)。这样,子网格就可以了该对话框将使用为主网格创建的验证器对象,
希望它有所帮助。
I had the same issue. The cause of mine is that my editable grid is on a modal dialog, and I think Telerik does not create the validator object when rendering a grid on a dialog rather than on a normal page.
I also had a non-editable grid on the main page that triggers the dialog. What I did is to append the "Editable(editing => editing.Mode(GridEditMode.InLine)" attribute to the main grid to pretend it is editable (but without rendering any command buttons). This way, the sub-grid on the dialog will use the validator object created for the main grid.
Hope it helps.