ASPXGridview更新事件回调后执行jquery
您好,我正在使用 DevExpress gridview,在更新事件时,我必须返回最终用户对话框消息,其中包含有关更新记录的信息
protected void AspxGrid_RowUpdated(object sender, ASPxDataUpdatedEventArgs e)
{
//After updated return some info on client side as modal window for example
}
是否有任何内置功能可以实现所需的输出,或者有任何其他足够的方法来实现它?
Hi I'm working with DevExpress gridview and on updated event I have to return end user dialog message with the information about updated record
protected void AspxGrid_RowUpdated(object sender, ASPxDataUpdatedEventArgs e)
{
//After updated return some info on client side as modal window for example
}
Is there any built in functionality to achieve desired output, or any other sufficient way to do it??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要将信息传递给客户端,您应该执行 2 个不同的步骤:
1) 将一个新项目添加到 ASPxGridView 的 JSProperties 集合,其中将包含所需的信息:
2) 处理 ASPxGridView 的客户端 EndCallback 事件以显示此消息:
编辑:
这是在这里工作的完整代码:
}" />
To pass the information to the client side, you should implement 2 different steps:
1) add a new item to the ASPxGridView's JSProperties collection which will contain the required info:
2) handle the ASPxGridView's client side EndCallback event to show this message:
Edit:
Here is the complete code which works here:
}" />
您不能直接从服务器事件引发客户端事件。但实现目标的方法有很多种,最好的方法取决于具体情况。几种可能性...
1) 捕获异步回发后发生的客户端事件(如果您使用部分回发)。 Google
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded
2) 在代码中插入客户端脚本,该脚本将在页面加载完成后运行,例如
ScriptManager.RegisterStartupScript("someJavascriptFunction( );");
(即伪代码 - 您还需要包含其他参数)
3) 在服务器事件期间渲染某些内容,该事件将在页面加载完成时触发客户端事件。假设您正在使用 jQuery 和
$(document).ready()
(并且不使用部分回发),您可以设置一个隐藏字段值,然后从客户端上的启动脚本检查该值并获取基于它你想要采取的任何行动。如果您使用 updatepanels,则必须执行 #1 或 #2 - 因为
document.ready
启动代码在部分回发后不会重新运行。You can't directly cause a client event from a server event. But there are a number of different ways to achieve the goal, the best one depends on the situation. A few possibilities...
1) Capture the client event that occurs after an async postback (if you're using partial postbacks). Google
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded
2) Insert a client script in code, which will be run after the page load is completed, e.g.
ScriptManager.RegisterStartupScript("someJavascriptFunction();");
(that is pseudocode - there are other parameters you need to include)
3) Render something during your server event that will trigger a client event when the page is done loading. Assuming you are using jQuery and
$(document).ready()
(and NOT using partial postbacks) you could set a hidden field value, and then check that value from the startup script on the client and take whatever action you want based on it.If you're using updatepanels, you will have to do #1 or #2 - because
document.ready
startup code will not re-run after a partial postback.请参阅有关此问题的回调的概念知识库文章。我希望它能帮助你。
Please refer to the The Concept of Callbacks KB article regarding this issue. I hope it will help you.