如何通过 Telerik MVC Grid Ajax 插入/更新/删除向客户端发送自定义错误消息?
我正在 Telerik Grid 扩展中使用 Ajax 编辑。我想处理插入/更新/删除上的错误/异常,并在显示回客户端的消息框中显示用户友好的消息,而不是默认消息“错误!请求的 URL 返回 500 - 内部服务器错误” ”或类似的内容。
有没有办法告诉网格显示自定义文本消息?
I am working with Ajax Editing within a Telerik Grid extension. I would like to handle errors/exceptions on Insert/Update/Delete and display a user friendly message in the message box that is displayed back to the client, instead of the default message of "Error! The requested URL returned 500 - Internal Server Error" or the like.
Is there a way to tell the grid to display a custom text message?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有人在这里定制了警报:http://www.telerik.com/community/forums/aspnet-mvc/grid/how-to-return-error-information-to-grid-in-ajax-editing -mode.aspx,但我仍在寻找一种方法来实际更新网格本身...
客户端网格的 noRecordsTemplate 属性有一点希望,但我们仍然需要一种方法来清除网格可能已经存在的任何记录。
编辑:
找到它:要清除网格并设置消息,请执行以下操作:
当然,您可以自己弄清楚如何将我的示例与上面链接中的示例结合起来。
Someone customized the alert here: http://www.telerik.com/community/forums/aspnet-mvc/grid/how-to-return-error-information-to-grid-in-ajax-editing-mode.aspx, but I'm still searching for a way to actually update the grid itself...
There's a little hope in the client-side grid's noRecordsTemplate property, but we still need a way to clear the grid of any records that may have already been there.
Edit:
Found it: To clear the grid, and set your message, do the following:
Of course, you can figure out on your own how to combine the my example and the example from the link above.