[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 333
  • Last Modified:

JavasScript Alert on Wizard Finish

Hi

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
			'Response.Write(blnValid)
			ScriptManager.RegisterStartupScript(Me, Me.GetType(), "jsCall", script, True)
		Else
			
			UpdateSecondariesMarketSales()
		End If

Open in new window

0
patelajk
Asked:
patelajk
  • 2
1 Solution
 
Praveen VenuCommented:
Can you break the code and see if it is hitting?
0
 
burakiewiczCommented:
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)
0
 
Praveen VenuCommented:
I have tried it and its working



ASPX
====
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:Wizard runat="server" ID="wiz1" ActiveStepIndex="0">
        <WizardSteps>
            <asp:WizardStep runat="server">
            </asp:WizardStep>
            <asp:WizardStep runat="server">
            </asp:WizardStep>
        </WizardSteps>
        <FinishNavigationTemplate>
            <asp:Button ID="FinishPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious"
                Text="Previous" />
            <asp:Button ID="FinishButton" runat="server" CommandName="MoveComplete" Text="Finish" />
        </FinishNavigationTemplate>
    </asp:Wizard>
    </div>
    </form>
</body>
</html>
 
 
 
 
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

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now