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");
}
精彩评论