问题描述
我希望使用带有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.
推荐答案
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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!