刚刚工作不久接触东西不多,只是一些自己的理解!
一般又两种页面跳转方式!
Response.Redirect("WebForm3.aspx");
Server.Tra sfer("WebForm3.aspx", true);
使用 Response.Redirect()方法进行跳转 你如果在后台想输出 alter()提示框不好使的! 但可以跳转出本网站。
使用 Server.Tra sfer("WebForm3.aspx", true); 可以输出提示后跳转 ,但只能在本网站跳转。虽然载入的是新页面但在地址栏显示的依然是旧的地址。如果第二个参数是true 在载入的新页面可以取的旧页面from 中的 标签 使用该语句取的。this.PreviousPage.FindControl("标签ID")).Value;
如果想在跳转时打开新页面 可以使用js的 open方法! 使用下面的方式可以防止页面的布局变乱
string url = string.Format("<script type=text/javascript>window.open('Test1.aspx?id={0}')</script>", id);
Page.ClientScript.RegisterStartupScript(this.GetType(), "", url);
或者在指定from target属性 为_blank