消息在try catch块中不起作用 [英] Message is not working in try catch block

查看:106
本文介绍了消息在try catch块中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当应用程序不在UserInteractive模式下运行时,显示模式对话框或窗体是无效操作.指定ServiceNotification或DefaultDesktopOnly样式以显示来自服务应用程序的通知.



说明:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪,以获取有关错误及其在代码中起源的详细信息.

异常详细信息:System.InvalidOperationException:当应用程序不在UserInteractive模式下运行时,显示模式对话框或窗体不是有效操作.指定ServiceNotification或DefaultDesktopOnly样式以显示来自服务应用程序的通知.


代码:

Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.



Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.


code :

Protected Sub gvList_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles gvList.RowDeleting

        Try
            clsReportType.DeleteReportType(gvList.DataKeys(e.RowIndex).Value)

            Dim strJs As String = "<script>alert('Record Deleted Successfully..');</script>"
            ScriptManager.RegisterClientScriptBlock(Me.Page, GetType(Page), "alert", strJs, False)
            ObjReportType.SelectCountMethod = "GetAllReportType"
            e.Cancel = True
        Catch ex As Exception
            ''MsgBox(ex.Message("Hello"))
            'Response.Write("Could not load weekly offers. ")
            'MsgBox(ex.ToString)   ' Show friendly error message.
            'Response.Write("An Exception has occurred.")
            MessageBox.Show("Report Already Exist In Report page!! So Fist Delete from Report Page")
            Response.Redirect("ReportType.aspx")
            'Response.Write("<script>window.close();</script>")

        End Try


我想在出现异常时显示一条消息,但该消息不起作用
并给出上面提到的错误类型.
我如何解决..plz告诉我的


I want to show a message when Exception is occoure but that Message is not working
and give that type of error which in mention above.
how i solve that ..plz tell my

推荐答案

ASP.Net没有MessageBox类.您要使用的是aspx文件中的CustomValidator控件.

Google是您的朋友.
ASP.Net doesn''t have a MessageBox class. What you want to use is a CustomValidator control in your aspx file.

Google is your friend.


这篇关于消息在try catch块中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆