asp:wizard call java script while next button click RRS feed

  • Question

  • User-1471881183 posted

    hello all,

    i have a user control, there i have asp:wizard in the following format

    <asp:UpdatePanel ID="Updatepanel1" runat="server">
        <asp:HiddenField ID="MyHidden" runat="server" ClientIDMode="Static"/>
                <asp:Label ID="lblStepTitle" runat="server" Text=""></asp:Label>
            <asp:Wizard ID="wzrPayment" runat="server" style="width: 100%;">
                    <asp:WizardStep ID="wsInvoiceSelection" runat="server" >
                        <ctl:invoiceList ID="invoiceList" runat="server" Visible="false" Mode="CheckBoxList" ShowTitle="false">
                    <asp:WizardStep ID="wsCreditCard" runat="server">
                    <asp:WizardStep ID="wsResume" runat="server">
                        <ctl:invoiceList ID="invoiceListConfirmation" runat="server" Mode="NoOption" ShowTitle="false">
                        <br />
                    <asp:WizardStep ID="wsPayment" runat="server">
                    <asp:WizardStep ID="wsResult" runat="server">
                        <ctl:paymentResult ID="paymentResult" runat="server" >
            <br />
            <ctl:paymentSummary ID="paymentSummary" runat="server" />
            <input type="submit" id="payButtonId" value="Checkout Now" onclick="return mute();"  />

    what i would like to achive is, while click Next button then it has to call a Java script function so, i referred https://www.dotnetcurry.com/ShowArticle.aspx?ID=347 and implement it in a seperate project in a webform it worked

    but, if i plug the same code into my real project (within user control) then its not working. could you please help me of how to call JS while click next button?

    thank you

    Tuesday, November 17, 2020 2:07 AM

All replies

  • User-939850651 posted

    Hi winseealn,

    I created a simple example based on your description, I tested it, and I found that it still works correctly. I don't know what you defined in User Control or what code you executed in Code behind, so I am not sure what is the cause of your issue.

    Here is my test:

    <%@ Register Src="~/invoiceList.ascx" TagPrefix="ctl" TagName="invoiceList" %>
    <%@ Register Src="~/paymentresult.ascx" TagPrefix="ctl" TagName="paymentresult" %>
    <%@ Register Src="~/paymentsummary.ascx" TagPrefix="ctl" TagName="paymentsummary" %>

    <form id="form1" runat="server"> <div> <asp:ScriptManager runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="Updatepanel1" runat="server"> <ContentTemplate> <div> <asp:HiddenField ID="MyHidden" runat="server" ClientIDMode="Static" /> </div> <h4> <asp:Label ID="lblStepTitle" runat="server" Text=""></asp:Label> </h4> <asp:Wizard ID="wzrPayment" runat="server" Style="width: 100%;"> <WizardSteps> <asp:WizardStep ID="wsInvoiceSelection" runat="server"> <ctl:invoicelist id="invoiceList" runat="server" visible="false" mode="CheckBoxList" showtitle="false"> </ctl:invoicelist> </asp:WizardStep> <asp:WizardStep ID="wsCreditCard" runat="server"> </asp:WizardStep> <asp:WizardStep ID="wsResume" runat="server"> <ctl:invoicelist id="invoiceListConfirmation" runat="server" mode="NoOption" showtitle="false"> </ctl:invoicelist> <br /> </asp:WizardStep> <asp:WizardStep ID="wsPayment" runat="server"> </asp:WizardStep> <asp:WizardStep ID="wsResult" runat="server"> <ctl:paymentresult id="paymentResult" runat="server"> </ctl:paymentresult> </asp:WizardStep> </WizardSteps> </asp:Wizard> <br /> <ctl:paymentsummary id="paymentSummary" runat="server" /> <input type="submit" id="payButtonId" value="Checkout Now" onclick="return mute();" /> </ContentTemplate> </asp:UpdatePanel> </div> </form>

    User control ( three similar user controls, take one of them as an example ):

    <h4>invoiceList context</h4>

    Code behind:

    protected void Page_Load(object sender, EventArgs e)
                Button btn = wzrPayment.FindControl("StartNavigationTemplateContainerID").FindControl("StartNextButton") as Button;
                if (btn != null)
                    btn.OnClientClick = "return confirm('Are you sure you want to move away from the beginning?')";
                 btn = wzrPayment.FindControl("StepNavigationTemplateContainerID").FindControl("StepNextButton") as Button;
                if (btn != null)
                    btn.OnClientClick = "return confirm('Are you positive you want to move next?')";
                btn = wzrPayment.FindControl("FinishNavigationTemplateContainerID").FindControl("FinishPreviousButton") as Button;
                if (btn != null)
                    btn.OnClientClick = "return confirm('Almost there!?')";


    If I misunderstood something, could you provide more details?

    Best regards,

    Xudong Peng

    Wednesday, November 18, 2020 7:41 AM
  • User-939850651 posted

    Hi winseealn,

    Have you solve your problem?

    Friday, November 27, 2020 7:19 AM