开发者

Run javascript on WizardStep activation

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');
       });
开发者_JS百科   </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.


you can run the js function on ActiveStepChanged event with a check on active step index like

if(e.ActiveStepIndex==X)
{
    Page.RegisterClientScriptBlock("scripidentifier","your script or call js function");
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜