在 WizardStep 激活时运行 javascript
我试图在特定的 WizardStep 激活后运行一些 javascript 代码:
<asp:WizardStep ID="wsPaymentMethods" runat="server">
<!-- some markup goes here -->
<script type="text/javascript">
alert('Outer alert');
Sys.Application.add_load(function () {
alert('Page loaded alert');
});
</script>
</asp:WizardStep>
但实际上这些警报都没有显示。这种行为是“设计使然”还是某种错误?
现在,我正在这样做:
protected void OrderWizard_ActiveStepChanged(object sender, EventArgs e)
{
if (OrderWizard.ActiveStep == wsPaymentMethods)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "customerFormInit", "customerFormInit()", true);
}
}
但我只是想知道为什么 WizardStep 中的 js 代码不执行任何操作。
I'm trying to run some javascript code after particular WizardStep becomes active:
<asp:WizardStep ID="wsPaymentMethods" runat="server">
<!-- some markup goes here -->
<script type="text/javascript">
alert('Outer alert');
Sys.Application.add_load(function () {
alert('Page loaded alert');
});
</script>
</asp:WizardStep>
But in fact none of these alerts has shown. Is that behaviour "by design" or this is some kind of bug?
For now, i'm doing thigs that way:
protected void OrderWizard_ActiveStepChanged(object sender, EventArgs e)
{
if (OrderWizard.ActiveStep == wsPaymentMethods)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "customerFormInit", "customerFormInit()", true);
}
}
But i'm just wondering why the js code inside WizardStep does nothing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 ActiveStepChanged 事件上运行 js 函数,并检查活动步骤索引,例如
you can run the js function on ActiveStepChanged event with a check on active step index like