用C#做Web程序,如何在一个页中打开另一个新页?

ttoomm 2003-06-23 01:26:11
谢了
...全文
163 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiajianfeng 2003-06-23
  • 打赏
  • 举报
回复
Response.Redirect("newpage.aspx");

则是转到新的页面;
xiajianfeng 2003-06-23
  • 打赏
  • 举报
回复
是弹出吗?
如果是,则
Response.Write("<script language='javascript'>window.open('newpage.aspx');</script>");

:)
孟子E章 2003-06-23
  • 打赏
  • 举报
回复
<%@ Page Language="C#" AutoEventWireup="True" %>
<%@ import Namespace="System" %>
<%@ import Namespace="System.Web.UI.WebControls" %>
<html>
<head>
<script language="C#" runat="server">
public void Page_Load(Object sender, EventArgs e) {
}
void openWin(Object sender, EventArgs e) {
Label1.Text="<iframe src='http://lucky_elove.www1.dotnetplayground.com/' width='100%'></iframe>>";
Label2.Text="<script>window.open('http://lucky_elove.www1.dotnetplayground.com/','_blank')</s"+"cript>";
}

</script>
</head>
<body topmargin="20" leftmargin="10">
<form id="myForm" runat="server">
<asp:Button id="Button1" runat="server" Text="Open Window" onclick="openWin"></asp:Button>
<br>
<asp:Label id="Label2" runat="server"></asp:Label>
<asp:Label id="Label1" runat="server"></asp:Label>
</form>
</body>
</html>
孟子E章 2003-06-23
  • 打赏
  • 举报
回复
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="aspxWebcs.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="WebForm1" method="post" runat="server">
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 23px; POSITION: absolute; TOP: 19px" runat="server" Text="Open Window"></asp:Button>
</form>
</body>
</HTML>


WebForm1.aspx.cs

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace aspxWebcs
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void Button1_Click(object sender, System.EventArgs e)
{
Label1.Text="<script>window.open('http://lucky_elove.www1.dotnetplayground.com','_a')</script>";
}
}
}
孟子E章 2003-06-23
  • 打赏
  • 举报
回复
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="aspxWebcs.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="WebForm1" method="post" runat="server">
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 116px; POSITION: absolute; TOP: 85px" runat="server" Text="Button"></asp:Button>
<asp:Label id="Label1" style="Z-INDEX: 102; LEFT: 246px; POSITION: absolute; TOP: 144px" runat="server"></asp:Label>
</form>
</body>
</HTML>


using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace aspxWebcs
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button Button1;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void Button1_Click(object sender, System.EventArgs e)
{
Label1.Text="<iframe src='http://lucky_elove.www1.dotnetplayground.com/'></iframe>";
}
}
}
shckylee 2003-06-23
  • 打赏
  • 举报
回复
Response.Redirect("XXX.aspx");
yyy159 2003-06-23
  • 打赏
  • 举报
回复
有简单的何必来麻烦的?
ttoomm 2003-06-23
  • 打赏
  • 举报
回复
我是说用C#的代码实现!
孟子E章 2003-06-23
  • 打赏
  • 举报
回复
<iframe src=""></iframe>

110,532

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧