c# - asp.net 网站中的消息框

标签 c# asp.net asp.net-mvc messagebox

using (DataServer server = new DataServer())
        {
            server.ExecuteNonQuery(CommandType.Text, updateuser, param);
        }
        MessageBox.Show("User succesfully updated");

当字段更新时,我有一个更新按钮,我显示一个消息框,但问题是消息框位于浏览器后面。我必须最小化浏览器才能关闭消息框,同时我能够在不关闭消息框的情况下在网站中导航,我想在显示消息框时模糊网站中的剩余区域。我怎样才能在我的网站上做到这一点。

<小时/>

最佳答案

在这种情况下,您要么想用 JavaScript 发出警报,要么使用某种对话框。

要发出警报,您可以执行以下操作:

Page.ClientScript.RegisterStartupScript(GetType(), "UserDialogScript", "alert(\"User successfully updated\");", true);

至于使用对话框,我建议使用ModalPopupExtenderjQuery UI Dialog

ModalPopupExtender:
http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/modalpopup/modalpopup.aspx

jQuery UI 对话框:
http://jqueryui.com/demos/dialog/

关于c# - asp.net 网站中的消息框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7576307/

相关文章:

asp.net-mvc - MVC自定义roleprovider如何将其连接到HttpContext.Current.User.IsInRole ("myrole")

c# - 在 ArrayList c# 中的多个参数之间排序

c# - 表单编辑器自动将子控件添加到 WPF Integration ElementHost

c# - 返回 IQueryable 类型 : The entity or complex type '' cannot be constructed in a LINQ to Entities query

asp.net - 无法为 ASP.NET.Core 应用程序加载文件或程序集 microsoft.visualstudio.editor.razor 2017

c# - Global.asax 中的 ASP.NET 导入命名空间错误

c# - try catch 异步异常

c# - .NET 跟踪不适用于 Diagnostics.TraceSource,仅适用于 Diagnostics.Trace

c# - 如何将参数和上传图片同时传递给 One web api?

c# - MVC4 命名部分 View "_XXPartial"..预期的 Controller 名称是什么?