一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

asp.net 中將表單提交到另一頁 Code-Behind(代碼和html在不同的頁面)

The following shows a complete example of the code-behind file associated with the Web Forms page sending the information. Depending on whether you use Visual Basic or C#, make sure this sample is called Firstpage.ASPx.vb or Firstpage.ASPx.cs, respectively.
[Visual Basic]
Imports System
Public Class FirstPageClass :
Inherits System.Web.UI.Page
Protected first As System.Web.UI.WebControls.TextBox
Protected last As System.Web.UI.WebControls.TextBox
Protected Button1 As System.Web.UI.WebControls.Button
Public ReadOnly Property FirstName() As String
Get
' first is the name of a TextBox control.
Return first.Text
End Get
End Property
Public ReadOnly Property LastName() As String
Get
' last is the name of a TextBox control.
Return last.Text
End Get
End Property
Sub ButtonClicked(sender As Object, e As EventArgs)
Server.Transfer("secondpage.ASPx")
End Sub
End Class
[C#]
using System;
public class FirstPageClass : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox first;
protected System.Web.UI.WebControls.TextBox last;
protected System.Web.UI.WebControls.Button Button1;
public string FirstName
{
get
{
return first.Text;
}
}
public string LastName
{
get
{
return last.Text;
}
}
void ButtonClicked(object sender, EventArgs e)
{
Server.Transfer("secondpage.ASPx");
}
}
The following shows a complete example of how to create a Web Forms page with a code-behind file to pass the values of two TextBox controls to another Web Forms page. Make sure this sample is called Firstpage.ASPx.
[Visual Basic]
<%@ Page Language="VB" Inherits="FirstPageClass" %>
<html>
<head>
</head>
<body>
<form runat="server">
First Name:
<ASP:TextBox id="first"
runat="server"/>
<br>
Last Name:
<ASP:TextBox id="last"
runat="server"/>
<br>
<ASP:Button
id="Button1"
OnClick="ButtonClicked"
Text="Go to second page"
runat=server />
</form>
</body>
</html>
[C#]
<%@ Page Language="C#" Inherits="FirstPageClass" %>
<html>
<head>
</head>
<body>
<form runat="server">
First Name:
<ASP:TextBox id="first"
runat="server"/>
<br>
Last Name:
<ASP:TextBox id="last"
runat="server"/>
<br>
<ASP:Button
id="Button1"
OnClick="ButtonClicked"
Text="Go to second page"
runat=server />
</form>
</body>
</html>
To receive Server control values from a different Web Forms page
The following shows a complete example of the code-behind file associated with the Web Forms page receiving the information. Depending on whether you use Visual Basic or C#, make sure this sample is called Secondpage.ASPx.vb or Secondpage.ASPx.cs, respectively.
[Visual Basic]
Imports System
Public Class SecondPageClass
Inherits System.Web.UI.Page
Protected DisplayLabel As System.Web.UI.WebControls.Label
Public fp As FirstPageClass
Sub Page_Load()
If Not IsPostBack Then
fp = CType(Context.Handler, FirstPageClass)
End If
End Sub
End Class
[C#]
using System;
public class SecondPageClass : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label DisplayLabel;
public FirstPageClass fp;
void Page_Load()
{
if (!IsPostBack)
{
fp = (FirstPageClass) Context.Handler;
}
}
}
The following shows a complete example of how to create a Web Forms page with a code-behind file to receive the values passed from a different Web Forms page. Make sure this sample is called Secondpage.ASPx
[Visual Basic]
<%@ Page Language="VB" Inherits="SecondPageClass" %>
<%@ Reference Page="firstpage.ASPx" %>
<html>
<head>
</head>
<body>
<form runat="server">
Hello <%=fp.FirstName%> <%=fp.LastName%>
</form>
</body>
</html>
[C#]
<%@ Page Language="C#" Inherits="SecondPageClass" %>
<%@ Reference Page="firstpage.ASPx" %>
<html>
<head>
</head>
<body>
<form runat="server">
Hello <%=fp.FirstName%> <%=fp.LastName%>
</form>
</body>
</html>

AspNet技術asp.net 中將表單提交到另一頁 Code-Behind(代碼和html在不同的頁面),轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 亚洲美女福利视频 | 国内精品久久久久久久999下 | 亚洲国产婷婷综合在线精品 | 美女扒开下面无遮挡免费视频 | 国产精品视频李雅 | www.婷婷色| 微拍秒拍福利一区二区 | 国产在线永久视频 | 九九久久亚洲综合久久久 | 国产精品极品美女自在线看免费一区二区 | 亚洲欧洲免费视频 | 免费精品国产福利片 | 玖玖玖视频在线观看视频6 玖玖免费 | 美女被性调教视频在线观看 | 激情视频激情小说激情图片 | 欧美亚洲国产日韩 | 午夜免费观看_视频在线观看 | 久久久久久一级毛片免费无遮挡 | 337p欧美超大胆日本人术艺术 | vr专区日韩精品中文字幕 | 国产99精品视频 | 中文字幕精品一区二区三区视频 | 免费人成网站尤物在线观看 | 欧美gogo高清bbw| 国产精品视频人人做人人爱 | 免费超爽大片黄网站 | 黄色小视频在线观看免费 | 成人免费观看黄a大片夜月 成人免费观看视频 | 韩国一级毛片免费完整视频 | 国产成人精品久久综合 | 国产精品福利在线播放 | 91精品久久久久久久久网影视 | 国产成人99精品免费观看 | 狠狠色狠狠色综合伊人 | 国产精品好好热在线观看 | 精品国产乱码久久久久久浪潮 | 天堂成人在线观看 | 久久香蕉综合精品国产 | 视色4se影院在线观看 | 天天拍拍天天爽免费视频 | 91免费资源网站入口 |