佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 647|回复: 3

请问为何会出现以下这段error message?

[复制链接]
发表于 25-5-2006 05:41 PM | 显示全部楼层 |阅读模式
我是添加了下面的code才出现error message的?
MsgBox("Data import completely!", MsgBoxStyle.Information, "Web System")

我该如何pop up message box in asp.net?

It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. 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: It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

[ 本帖最后由 counterking 于 25-5-2006 05:44 PM 编辑 ]
回复

使用道具 举报


ADVERTISEMENT

发表于 25-5-2006 06:40 PM | 显示全部楼层
messagebox 是不能用在asp.net的... 只能用在windows application form... 而不是web form... 要使用messagebox的话必须配合javascript或其他client-side script...
回复

使用道具 举报

 楼主| 发表于 25-5-2006 09:21 PM | 显示全部楼层
我找到以下的code.. 已经可以pop up message box了,在此和大家分享一下
另外,想请教大家要如何improve这个code...
因为目前不能更改message box的title, 以及只能显示感叹号的符号




Public Sub MsgBox(ByVal Message As String)

   System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE=""JavaScript"">" & vbCrLf)
   System.Web.HttpContext.Current.Response.Write("alert(""" & Message & """)" & vbCrLf)
   System.Web.HttpContext.Current.Response.Write("</SCRIPT>")

End Sub


[ 本帖最后由 counterking 于 25-5-2006 09:23 PM 编辑 ]
回复

使用道具 举报

发表于 26-5-2006 09:22 AM | 显示全部楼层
原帖由 counterking 于 25-5-2006 09:21 PM 发表
我找到以下的code.. 已经可以pop up message box了,在此和大家分享一下
另外,想请教大家要如何improve这个code...
因为目前不能更改message box的title, 以及只能显示感叹号的符号

http://www.101uod.net ...


Javascript 不能那么做, 能这么做的只有 VBScript, 但全部 Browser 都不支持 VBScript, 除了 Internet Explorer. 如果你真的要那么做...

MsgBox ("Hello World!", 1, "MsgBox Example")

注: 1 = vbOKCancel
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 22-9-2024 05:35 PM , Processed in 0.107309 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表