
asp.net弹出提示与跳转方式
1,页面中显示:
Response.Write(i.ToString ()+"<br>");
2,对话框显示:
Page.RegisterStartupScript("msg", "<script>alert('" + _info + "')<" + "/script>");
Response.Write("<script>alert('"+_info+"')<" + "/script>");
3.提示之后再跳转:
Response.Write("<script>alert('注册成功');window.location='/employee/stulogsuccess.aspx';<" + "/script>");
注:此方法不可用window.history.back()返回;
4.直接跳转:
Response.Redirect("/employee/stulogsuccess.aspx",false);
5.用js跳转:
Response.Write("<script>window.location='/employee/stulogsuccess.aspx';<" + "/script>");
6.带参数跳转:
Response.Redirect("/Controls/error.aspx?msg="+Server.UrlEncode("提交信息没有成功。请与系统管理员联系。"));
注:
Response.Write()不是最好的办法,请使用ClientScript.RegisterClientScriptBlock(GetType(),"msg", "<script>alert('" + _info + "')<" + "/script>");代替!
Response.Write是覆盖写入,ClientScript.RegisterClientScriptBlock是向页面插入脚本。
============ 欢迎各位老板打赏~ ===========


与本文相关的文章
- · The instance of entity type ‘Customer’ cannot be tracked because another instance with the same key value for {‘Id’} is already being tracked.
- · .NET8实时更新nginx ip地址归属地
- · 解决.NET Blazor子组件不刷新问题
- · .NET8如何在普通类库中引用 Microsoft.AspNetCore
- · .NET8 Mysql SSL error
- · ASP.NET Core MVC的Razor视图渲染中文乱码的问题
- · .NETCORE 依赖注入服务生命周期
- · asp.net zero改mysql
- · .NET5面试汇总
- · .Net连接Mysql数据库的Convert Zero Datetime日期问题
- · vue使用element-ui中的Message 、MessageBox 、Notification
- · Asp.Net Core Filter 深入浅出的那些事-AOP