Asp.net两个页面如何跳转

2025-04-18 09:59:10

1、在电脑上打开Visual Studio编译器,Visual Studio2015版巡綮碣褂或2017版及其他版本都可以。

Asp.net两个页面如何跳转
Asp.net两个页面如何跳转

2、在左上角找到文件,点击左上角的文件,点击新建,点击项目。

Asp.net两个页面如何跳转

3、在Visual C#中选择ASP.NET web应用程序,下方可以编辑保存的路径和项目名字。

Asp.net两个页面如何跳转

4、在弹出的窗体中,选择第一个,点击确定。

Asp.net两个页面如何跳转

5、在这里直接点击cancel。

Asp.net两个页面如何跳转

6、项目创建完成后,在右上角找到项目,鼠标右键,添加,web窗体。

Asp.net两个页面如何跳转

7、给新建的web窗体起一个名字,这里给小伙伴提个醒,最好用001这样子去给它命名,方便记忆,不容易混乱。

Asp.net两个页面如何跳转

8、这里要创建两个web窗体,一个叫001.aspx,一个叫002.aspx,页面传值需要用到两个页面。

Asp.net两个页面如何跳转

9、在001.aspx中输入如下代码:<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="001.aspx.cs" Inherits="WebApplication3.WebForm1" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title></head><body> <form id="form1" runat="server"> <center> <asp:Button ID="Button2" runat="server" Text="点击跳转到002页面" PostBackUrl="~/002.aspx" ></asp:Button> </center> </form></body></html>这里要注意,PostBackUrl="~/002.aspx"是跳转的页面的名字。

Asp.net两个页面如何跳转

10、在002.aspx中输入:<%@ Page Language="C拭貉强跳#" AutoEventWireup="true" Co颊俄岿髭deBehind="002.aspx.cs" Inherits="WebApplication3._002" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title></head><body> <form id="form1" runat="server"> <center> 终于等到你 </center> </form></body></html>

Asp.net两个页面如何跳转

11、点击运行,点击按钮。

Asp.net两个页面如何跳转

12、跳转到002页面

Asp.net两个页面如何跳转
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢