4

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
peterh
  • 11,875
  • 18
  • 85
  • 108
Patrick Lopez
  • 51
  • 1
  • 1
  • 3

2 Answers2

8

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>")
AsTi
  • 127
  • 11
1
Response.Write("<SCRIPT LANGUAGE=""JavaScript"">  alert('Complete');</script>")
rink.attendant.6
  • 44,500
  • 61
  • 101
  • 156