简体   繁体   English

Msgbox不会弹出vb.net(VS2012)

[英]Msgbox doesn't popup vb.net (VS2012)

I have this code for onclick event and the msgbox doesn't popup. 我的onclick事件有此代码,msgbox不会弹出。 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

MsgBox is a function for client-side WinForms or WPF code. MsgBox是用于客户端 WinForms或WPF代码的函数。 You are writing server-side ASP.NET code. 您正在编写服务器端 ASP.NET代码。 With ASP.NET, there is no simple method to show a message box to the end user. 使用ASP.NET,没有简单的方法向最终用户显示消息框。

There are, however, alternatives: You can use 但是,还有其他选择:您可以使用

  • client-side JavaScript to show a message box to the user or 客户端JavaScript,向用户显示消息框,或

  • use the ModalPopup control from the ASP.NET Ajax Library, which creates a HTML/JavaScript control that looks similar to a Windows message box. 请使用ASP.NET Ajax库中的ModalPopup控件 ,该控件创建一个看上去类似于Windows消息框的HTML / JavaScript控件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM