Patrick Lopez
Patrick Lopez

Reputation: 51

How can I create an alert popup message in vb?

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

Upvotes: 4

Views: 58751

Answers (2)

Ponlawat Sitthiwet
Ponlawat Sitthiwet

Reputation: 7

Response.Write("<SCRIPT LANGUAGE=""JavaScript"">  alert('Complete');</script>")

Upvotes: 1

AsTi
AsTi

Reputation: 127

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>")

Upvotes: 8

Related Questions