Msgbox doesn't popup vb.net (VS2012)

839 Views Asked by At

I have this code for onclick event and the msgbox doesn't popup. It will be blinking on the status bar waiting to be clicked. Why doesn't it popup.

Dim msg As String = "Patron " & PatName & " has been added to the system?" & vbCrLf
        msg = msg + "Do you want to add incident to this patron?"
Dim title As String = "Patron addition confirmation"

 Dim MsgResponse As String = MsgBox(msg, MsgBoxStyle.YesNo, title)

    If MsgResponse = 1 Then
            Response.Redirect("~/AddInciInfo.aspx?value1=" & PassParameters, False)
    Else
            Me.Dispose()
            Response.Redirect("~/SearchPatron.aspx", False)
    End If
1

There are 1 best solutions below

2
On BEST ANSWER

MsgBox is a function for client-side WinForms or WPF code. You are writing server-side ASP.NET code. With ASP.NET, there is no simple method to show a message box to the end user.

There are, however, alternatives: You can use

  • client-side JavaScript to show a message box to the user or

  • use the ModalPopup control from the ASP.NET Ajax Library, which creates a HTML/JavaScript control that looks similar to a Windows message box.