国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

asp.net頁面傳值測試實例代碼(前后臺)

2024-07-10 12:45:07
字體:
來源:轉載
供稿:網友
WebForm_1.aspx內容如下:
代碼如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm_1.aspx.cs" Inherits="頁面傳值.WebForm_1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Table ID="TableLogin" runat='server'>
<asp:TableRow>
<asp:TableCell><label>用戶名:</label></asp:TableCell>
<asp:TableCell><asp:TextBox ID="UserName" runat="server" Width="150px"></asp:TextBox></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell><label>密碼:</label></asp:TableCell>
<asp:TableCell><asp:TextBox ID="PassWord" runat="server" Width="150px"></asp:TextBox></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell><label>驗證密碼:</label></asp:TableCell>
<asp:TableCell><asp:TextBox ID="ConfimPWD" runat="server" Width="150px"></asp:TextBox></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell><asp:Button ID="Confirm" runat="server" Text="確認" Width="50px" OnClick="Confirm_Click" /></asp:TableCell>
</asp:TableRow>
</asp:Table>
</div>
</form>
</body>
</html>

WebForm_2.aspx頁面如下:
代碼如下:
<%@ Reference Page="~/WebForm_1.aspx" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm_2.aspx.cs" Inherits="頁面傳值.WebForm_2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>

WebForm_1.aspx.cs文件如下:
代碼如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace 頁面傳值
{
public partial class WebForm_1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string un//得到用戶名
{
get
{
return UserName.Text;
}
}
public string pwd//得到密碼
{
get
{
return PassWord.Text;
}
}
public string conpwd//得到確認密碼
{
get
{
return ConfimPWD.Text;
}
}
/// <summary>
/// 向WebForm_2.aspx頁面傳值
/// </summary>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 东台市| 衢州市| 和平区| 江陵县| 长寿区| 本溪市| 巴林左旗| 万全县| 凭祥市| 张家口市| 嵩明县| 商南县| 金华市| 吴川市| 博爱县| 治县。| 婺源县| 阿荣旗| 库车县| 韶关市| 临西县| 巴彦淖尔市| 中超| 平原县| 安多县| 吉木萨尔县| 嫩江县| 松滋市| 鲁甸县| 云南省| 景东| 裕民县| 普格县| 雅安市| 旬阳县| 衡东县| 监利县| 高安市| 浦县| 永善县| 东港市|