How can I create an alert popup message in vb?

45,503

Solution 1

If you want to pop-up the message box, just add this to the button code:

onclientclick="javascript:alert('Congratulations!');"

Or in the code behind:

Response.Write("<script language=""javascript"">alert('Congratulations!');</script>")

Solution 2

Response.Write("<SCRIPT LANGUAGE=""JavaScript"">  alert('Complete');</script>")
Share:
45,503
Patrick Lopez
Author by

Patrick Lopez

Updated on February 15, 2021

Comments

  • Patrick Lopez
    Patrick Lopez about 3 years

    How can I create a popup alert message in vb when my button is click?

    Here is my page load code looks like:

    Imports System.Net.Mail
    Imports System.IO
    Imports System.Text
    Public Class locker
        Inherits System.Web.UI.Page
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Request.IsAuthenticated Then
                WelcomeBackMessage.Text = "Welcome back!"
            
    
                 AuthenticatedMessagePanel.Visible = True
                AnonymousMessagePanel.Visible = True
            Else
                AuthenticatedMessagePanel.Visible = False
                AnonymousMessagePanel.Visible = True
            End If
    
            Dim ident As FormsIdentity = CType(User.Identity, FormsIdentity)
            Dim authTicket As FormsAuthenticationTicket = ident.Ticket
            WelcomeBackMessage.Text = "Welcome, " & User.Identity.Name & "!"
    
        End Sub
    
    
        Protected Sub send_Click(sender As Object, e As EventArgs) Handles send.Click
                  <<<<----------popup message coded here------------>>>>>>>>>
        End Sub
    End Class