如何在asp.net中的托管文件中显示Messagebox [英] How to show the Messagebox in hosted file in asp.net
问题描述
嗨
我托管了我的项目。但MessageBox仅在localhost中工作。它不能在服务器上工作
我也使用了javascript。但现在我想要没有javascript来显示MessageBox。当我在MessageBox中使用Windows控件时,它只能在localhost中工作。所以Plz任何人都可以帮助托管文件来显示MessageBox。
Hi
I hosted my project.But the MessageBox work in localhost only. its not work in server
i also used javascript. But now i want without javascript to show MessageBox. When i taken windows control in MessageBox it will work in localhost only. So Plz any one can help to hosted file to show MessageBox.
推荐答案
请尝试以下代码:
Please try the following code:
/// <summary>
/// Show client-side messagebox.
/// </summary>
/// <param name="msg"></param>
private void MessageBox(string msg)
{
string script = "window.alert('" + msg.Replace("'", "\\'") + "')";
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), Guid.NewGuid().ToString(), script, true);
}
您可以将它用作:
You can use it as:
MessageBox("Type your msg here!");
== OR ==
您可以创建自己的MessageBox并调用它。
例如: ASP.NET MessageBox [ ^ ]
祝你好运,
OI
==OR==
You can create your own MessageBox and call it.
For ex: ASP.NET MessageBox[^]
Good luck,
OI
这篇关于如何在asp.net中的托管文件中显示Messagebox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!