JavasScript Alert on Wizard Finish

Posted on 2009-02-11
Last Modified: 2012-05-06

I have some code below which should display a javascript alert if a boolean value is false when the "finish" button is clicked on a wizard.

I can'  seem to get the alert to fire on the wizard finish but can on a ordinary command button any ideas on how to solve this?
Dim strErrorMSG As String = "Firm " & strFirmName & " must be a seller or buyer and cannot be both"

		Dim script As String = "alert('" & strErrorMSG & ".');"		

If blnValid = False Then


			ScriptManager.RegisterStartupScript(Me, Me.GetType(), "jsCall", script, True)




		End If

Open in new window

Question by:patelajk
    LVL 15

    Expert Comment

    by:Praveen Venu
    Can you break the code and see if it is hitting?
    LVL 16

    Accepted Solution

    if its hitting the correct line change me to the name of an update panel if you have one on the page ie...
    ScriptManager.RegisterStartupScript(upMain, upMain.GetType(), "jsCall", script, True)
    LVL 15

    Expert Comment

    by:Praveen Venu
    I have tried it and its working

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="" >
    <head runat="server">
        <title>Untitled Page</title>
        <form id="form1" runat="server">
        <asp:Wizard runat="server" ID="wiz1" ActiveStepIndex="0">
                <asp:WizardStep runat="server">
                <asp:WizardStep runat="server">
                <asp:Button ID="FinishPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious"
                    Text="Previous" />
                <asp:Button ID="FinishButton" runat="server" CommandName="MoveComplete" Text="Finish" />
    VB File
    Partial Class Default2
        Inherits System.Web.UI.Page
        Protected Sub wiz1_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles wiz1.FinishButtonClick
            Dim strFirmName As String = "test123"
            Dim strErrorMSG As String = "Firm " & strFirmName & " must be a seller or buyer and cannot be both"
            Dim script As String = "alert('" & strErrorMSG & ".');"
            ScriptManager.RegisterStartupScript(Me, Me.GetType(), "jsCall", script, True)
        End Sub
    End Class

    Open in new window


    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on could not pull conte…
    Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now