如何使用ASP.NET C#在Win Server 2008 R2中使用MessageBox? [英] How to use MessageBox in Win Server 2008 R2 using ASP.NET C#?

查看:79
本文介绍了如何使用ASP.NET C#在Win Server 2008 R2中使用MessageBox?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用带有ASP.NET的Windows Server 2008 R2中的MessageBox使用C#显示任何类型的消息。



我使用以下代码:



MessageBox.Show(注册成功完成,成功!!,MessageBoxButtons.OK,MessageBoxIcon.Information);



但显示错误:(下图):



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





请解决此问题。

I want to show any type of message using MessageBox in Windows Server 2008 R2 with ASP.NET using C#.

I use bellow this code:

MessageBox.Show("Registration Successfully Completed", "Success!!", MessageBoxButtons.OK, MessageBoxIcon.Information);

But show error:(bellow):

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.


Please solve this problem.

推荐答案

如果您需要向客户端显示消息框;你需要使用像javascript这样的客户端编程之一。

查看此答案 [ ^ ]

你也可以使用 Ajax ModalPopup [ ^ ]
if you need to show message box to client; you need to use one of client side programming like javascript.
Check this Answer[^]
and also you can use Ajax ModalPopup[^]


您好prakashmondal,您无法在ASP.NET环境中显示MessageBox,因为ASPNET的结果是HTML和Javascript。想象一下,你有一个从Linux连接的客户端,Linux无法安装.NET Framework,因此MessageBox的类不存在。



Hi prakashmondal, you cannot show a MessageBox in an ASP.NET environment because the result of ASPNET is HTML and Javascript. Imagine that you have a client that connect from Linux, Linux cannot install .NET Framework so the MessageBox's class doesn't exists there.

string script = "alert('Registration Successfully Completed!');";
ScriptManager.RegisterStartupScript(this, GetType(), 
                      "ServerControlScript", script, true);





希望它有所帮助。



Hope it helps.


嗨!
Christian Amado





我想用MessageBox作为我的选择....... .......





I want to use MessageBox as my choice like that..............

DialogResult DiaR = MessageBox.Show("Registration Successfully Completed.Want to register another student?", "Success!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (DiaR.ToString() == "Yes")
                {
                    ////some actions
                }
                else
                {
                    // some action.......
                }







那么如何使用???




Then How to use???


这篇关于如何使用ASP.NET C#在Win Server 2008 R2中使用MessageBox?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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