消息在try catch块中不起作用(Message is not working in try catch block)

   IT问题网   2021-01-22 00:00:00

问 题

当应用程序未在userinteractive模式下运行时显示模式对话框或表单不是有效操作。指定servicenotification或defaultdesktoponly样式以显示来自服务应用程序的通知。







描述:在执行当前web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的起源的更多信息。



异常详细信息:system.invalidoperationexception:显示模式对话框或表单时应用程序未在userinteractive模式下运行不是有效的操作。指定servicenotification或defaultdesktoponly样式以显示来自服务应用程序的通知。





代码:

受保护sub gvlist_rowdeleting(byval sender as object,byval e as system.web.ui.webcontrols.gridviewdeleteeventargs)处理gvlist.rowdeleting 

尝试
clsreporttype.deletereporttype(gvlist.datakeys(e.rowindex) .value)

dim strjs as string ="lt; script gt; alert('记录已成功删除..'); lt; / script gt; "
scriptmanager.registerclientscriptblock(me.page,gettype(page),"alert",strjs,false)
objreporttype.selectcountmethod ="getallreporttype"
e.cancel = true
catch ex as exception
''msgbox(ex.message("你好"))
'response.write("无法加载每周优惠。 ")
'msgbox(ex.tostring)'显示友好的错误消息。
'response.write("发生异常。")
messagebox.show("报告已经存在于报告中页面!!所以拳头从报告页面删除")
response.redirect("reporttype.aspx")
'response.write("lt; script gt; window.close(); lt; / script gt; ")

结束尝试


我希望在exception为occoure时显示一条消息,但该消息不起作用

并提供上述类型的错误。 />
我怎么解决..plz告诉我的

解决方案

asp.net没有 messageboxclass。你想要使用的是 customvalidatorcontro l在你的aspx文件中。



谷歌是你的朋友。

标签:消息动静音讯不起作用



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

循环如何从开始日期算起5天(How loop to count for 5 days from the start date)

problem hi i have a starting date, now i nee ...

如何绑定diffirent windows窗体中使用的相同用户控件组合框的两个数据源(how to bind two data sources for same user control combo box used in diffirent windows forms)

problem lt;pre lang="c#"gt;lt;/pregt; i want to bind two ...

是他们的任何querybuilder工具(Is Their any querybuilder tool)

problem i want to know that is dere any gui q ...

我希望从gridview获得一个链接来搜索报告页面(i want to have a link from a gridview that will search a report page)

problem can someone help me i want to search fromgridview ...

存储文本框值时无法获得正确的输出(not getting correct output when storing textbox values)

problem i keep getting the output in messagebox as ''0'' ...

如何在asp.net中调用客户端的服务器端功能?(How to call server side function in client side in asp.net)

problem how to call server side function in client side i ...

将Excel数据导入并更新到sql中(Import and Update Excel data into sql)

problem hi, am working on a project which import data int ...

如何在asp中使用我的sql(How to use my sql in asp)

problem hi sir/madam, in our application of asp,we have ...

如何制作wpf鼠标事件?(How can made wpf mouse event )

problem how can made wpf mouse event see more: c# please ...

如何在包含三个用于用户输入的asp.net服务器控件的表中动态添加行(how to add rows dynamically in the table containing three asp.net server controls for user input)

problem hi a table having 5 rows and 3 columns, each ro ...

如何将string []数组值分配给cookie(How to assign a string[] array values to a cookie)

problem i have a string array and it is filling by databa ...

在基本MSI项目中从InstallShield显示消息“安装程序需要64位处理器”(Show message “Setup requires a 64Bit processor” from InstallShield in basic MSI project)

problem i am using installshield 11 and creat ...

c ++编程语言(c++ programming language)

problem hello all, i am looking to design c++ code for is ...

MySql DB(如何在部署时添加DB)(MySql DB(how to add DB at the time of deployment))

problem hello, i am going to deploy(c#.net with mysql 5.0 ...

如何为15个链接按钮单击事件实现相同的代码(How to implement same code for 15 linkbutton click events)

problem hi, i want to bind a tree in horizon ...

在数据网格中更改字段的名称(change field's name in a datagrid)

problem how can i change name of the each header columns ...

使用多个mdi表单(working with mutiple mdi forms)

problem hello i have a c sharp application, which contai ...

更改Html对象Zindex(Change Html Object Zindex)

problem hi all i have an object in my page. i ...

GDI +中发生一般错误的问题。(problem with A generic error occurred in GDI+.)

problem hi all when i want save image from fileupload fa ...

编写非肥皂网服务(Writing Non soap web service)

problem please let me know how to write a non ...