ASP.NET - 的UpdatePanel和JavaScript [英] ASP.NET - UpdatePanel and JavaScript
问题描述
是否有当一个UpdatePanel过程完成后运行脚本的方式。
Is there a way to execute script when an UpdatePanel process is finished.
我有一个页面,允许插入,复制,以及记录的编辑。
这是一个UpdatePanel至prevent页面导航全部完成。
别的地方在页面上我想打印一个闪的消息 - 您已经成功地进入了一个纪录像这是不是在附近的UpdatePanel,我想使用的消息一个jQuery的影响,因此在4秒后淡出。我如何发送脚本回来的UpdatePanel的或有它执行的UpdatePanel刷新后?我应该写剧本到一个asp:文字?什么想法?
I have a page that allows "inserting", "copying", and "editing" of a record. This is all done on an UpdatePanel to prevent a page navigation. Somewhere else on the page I would like to print a "flash" message - like "You have successfully entered a record." It is not near the UpdatePanel and I'd like to use a jQuery effect on the message so it fades out after 4 seconds. How can I send script back with the UpdatePanel or have it execute after a UpdatePanel refresh? Should I write script to an asp:literal? thoughts?
推荐答案
是:
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);
和则:
function endRequestHandler(sender, args)
{
// Do stuff
}
href=\"http://msdn.microsoft.com/en-us/library/bb383810.aspx\">和的here 。请记住,这将火每个页面上的AJAX请求。
Documentation here and here. Keep in mind that this will fire for every AJAX request on the page.
这篇关于ASP.NET - 的UpdatePanel和JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!