protected void Page_Load(object sender, EventArgs e)
{
if(Page.PreviousPage==null)
{
//这里相当于要写winform的messagebox.show("您没有从原页面进入,现在自动转入原页面")
Server.Transfer("training.aspx");
}
}请问要怎么写才能有messagebox的效果
解决方案 »
- 如何实现像文本控件一样输入的下拉列表
- 初学者的问题(js代码如何放在需要用的地方)
- atlas中,UpdatePanel可以欠套吗?
- ASP.Net级联DropDownList显示的设置问题
- javascript中怎么产生一个随即数???
- 我做的B/S软件放在中文WINDOWS服务器上能运行,那么如果放在英文Windows上能正常运行吗?客户端会出现乱字符吗??
- 最后十分,请教一个html的问题,请各位来看看,多谢
- 各位老大空了看看这个哈,我实在是没分了
- 各位讨论一下web服务器控件和Html控件吧,我现在越来越迷茫,来着有分!
- 使用vscode调试,单步调试进不去类库方法
- DropDownList联动问题
- Profile怎么跟现有的项目整合在一起?
{
Response.Write(
"<body>
<script>
if(confirm('您没有从原页面进入,现在自动转入原页面'))
Response.Redirect("...");
else
......
</script>
</body>"
);
}
{
if (message == null)
message = "";
message = message.Replace(" ", "\"");
System.Web.HttpContext.Current.Response.Write("<script>alert('" + message + "');</script>");
}把这个封装到一个类里去掉用试试
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;/// <summary>
/// AlertMessage 的摘要描述
/// </summary>
public class AlertMessage
{
public AlertMessage()
{
//
// TODO: 在此加入构造函数的程序代码
//
} //显示JavaScript的Alert信息
public void showMsg(Page thisPage,string AlertMessage)
{
Literal txtMsg = new Literal();
txtMsg.Text = "<script>alert('" + AlertMessage + "')</script>" + "<BR/>";
thisPage.Controls.Add(txtMsg);
}
}
window.location.....
/// 把普通文本串转化成 JavaScript 中的文本串
/// </summary>
/// <param name="value">原始串</param>
/// <returns>转换后串</returns>
private static string ConvertJSString(string value)
{
return value.Replace("'", @"\'").Replace("\r", @"\r").Replace("\n", @"\n");
} /// <summary>
/// 弹出alert窗口
/// </summary>
/// <param name="message">弹出框内容</param>
public static void Show(System.Web.UI.Page page, string message)
{
Show(page, message, false);
}
http://www.cnblogs.com/jintan/archive/2008/10/25/1319308.html