AFER回发从更新面板

AFER回发从更新面板

本文介绍了调用JavaScript code AFER回发从更新面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看了

但我的问题仍然存在。我试图执行上回发一个javascript多的时间,和脚本只执行第一次页面加载。

but my problem still there. I try to execute a javascript multiple time on post back, and the script only execute the first time the page load.

要确保脚本是每个注册后回去后,我使用的JavaScript键名一个GUID。

To make sure the script is register after each post back i use a guid for the javascript key name.

var xyz = DateTime.Now.ToLongTimeString();
  string script = @"BrokerCustomValue.value='" + CustomValueToBrokerListSerialized + "';alert('" + xyz + "');";
  ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), script, true);

我需要precise,在一个更​​新面板上的链接按钮,点击后,我回发事件火灾。如果我直接在页面上把我的链接按钮操它的工​​作

I need to precise that my post back event fire after a click on a link button in an update panel. If i put my link butto directly in the page it's working

推荐答案

我找到了解决方案。

当您使用更新面板和whant注册脚本,需要对用户的UpdatePanel,并在的RegisterStartupScript的参数类型的UpdatePanel

When you use an update panel and whant register script, you need to user updatePanel, and updatepanel type in param of the registerstartupscript

是这样的:

var xyz = DateTime.Now.ToLongTimeString();
  string script = @"BrokerCustomValue.value='" + CustomValueToBrokerListSerialized + "';alert('" + xyz + "');";
  ScriptManager.RegisterStartupScript(_updPanel, _updPanel.GetType(), Guid.NewGuid().ToString(), script, true);

这篇关于调用JavaScript code AFER回发从更新面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 20:55