ASP.NET Web 应用程序消息框 [英] ASP.NET Web Application Message Box
问题描述
在一个asp.net windows窗体应用程序中,在后面的C#代码中可以使用:
In an asp.net windows forms application, in the C# code behind you can use:
MessageBox.Show("Here is my message");
asp.net 网络应用程序中是否有任何等价物?我可以从背后的 C# 代码中调用一些东西来向用户显示一个消息框吗?
Is there any equivalent in a asp.net web application? Can I call something from the C# code behind that will display a message box to the user?
示例用法:我有一个按钮,可以在后面的代码中加载文件.加载文件或出现错误时,我想向用户弹出一条消息,说明结果.
Example usage of this: I have a button that loads a file in the code behind. When the file is loaded or if there is an error I would like to popup a message to the user stating the result.
对此有什么想法吗?
推荐答案
您想使用警报.不幸的是,它不如 Windows 窗体好.
You want to use an Alert. Unfortunately it's not as nice as with windows forms.
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + myStringVariable + "');", true);
类似于这里的这个问题:http://forums.asp.net/t/1461308.aspx/1
Similar to this question here: http://forums.asp.net/t/1461308.aspx/1
这篇关于ASP.NET Web 应用程序消息框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!