如何在asp.net中的托管文件中显示Messagebox [英] How to show the Messagebox in hosted file in asp.net

查看:87
本文介绍了如何在asp.net中的托管文件中显示Messagebox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我托管了我的项目。但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屋!

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