最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

 更新時(shí)間:2009年04月13日 11:34:07   作者:  
To send 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 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>

相關(guān)文章

  • 如何為asp.net core添加protobuf支持詳解

    如何為asp.net core添加protobuf支持詳解

    這篇文章主要給大家介紹了關(guān)于如何為asp.net core添加protobuf支持的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。
    2018-02-02
  • Asp.Net中索引器的用法分析

    Asp.Net中索引器的用法分析

    這篇文章主要介紹了Asp.Net中索引器的用法,以實(shí)例形式詳細(xì)分析了Asp.Net中索引器的定義、屬性與具體使用方法,并附帶說(shuō)明了相關(guān)的注意事項(xiàng),在asp.net項(xiàng)目開(kāi)發(fā)中有不錯(cuò)的參考借鑒價(jià)值,需要的朋友可以參考下
    2014-11-11
  • asp.net 結(jié)合YUI 3.0小示例

    asp.net 結(jié)合YUI 3.0小示例

    公司最近做了個(gè)WEB項(xiàng)目,網(wǎng)上這方面的東西也很少的,沒(méi)辦法就自己摸索了。 用到了Ajax這一段時(shí)間研究了一下它的用法,故來(lái)解釋一下。
    2009-11-11
  • .Net反向代理組件Yarp用法詳解

    .Net反向代理組件Yarp用法詳解

    本文詳細(xì)講解了.Net反向代理組件Yarp的用法,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-09-09
  • .Net?Core日志記錄之第三方框架Serilog

    .Net?Core日志記錄之第三方框架Serilog

    這篇文章介紹了.Net?Core日志記錄之第三方框架Serilog,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-06-06
  • asp.net下定制日期輸出格式的代碼

    asp.net下定制日期輸出格式的代碼

    asp.net下定制日期輸出格式的代碼...
    2007-09-09
  • ASP.NET中Dictionary基本用法實(shí)例分析

    ASP.NET中Dictionary基本用法實(shí)例分析

    這篇文章主要介紹了ASP.NET中Dictionary基本用法,結(jié)合實(shí)例形式分析了Dictionary的基本功能、使用步驟與相關(guān)操作技巧,需要的朋友可以參考下
    2016-08-08
  • asp.net 臟字典過(guò)濾問(wèn)題 用正則表達(dá)式來(lái)過(guò)濾臟數(shù)據(jù)

    asp.net 臟字典過(guò)濾問(wèn)題 用正則表達(dá)式來(lái)過(guò)濾臟數(shù)據(jù)

    asp.net 臟字典過(guò)濾問(wèn)題 用正則表達(dá)式來(lái)過(guò)濾臟數(shù)據(jù)
    2009-10-10
  • asp.net 定時(shí)間點(diǎn)執(zhí)行任務(wù)的簡(jiǎn)易解決辦法

    asp.net 定時(shí)間點(diǎn)執(zhí)行任務(wù)的簡(jiǎn)易解決辦法

    這里的定時(shí)間點(diǎn)執(zhí)行任務(wù),指的是每天的某個(gè)時(shí)間執(zhí)行一項(xiàng)任務(wù)。
    2009-12-12
  • VS2015 搭建Asp.net core開(kāi)發(fā)環(huán)境的方法

    VS2015 搭建Asp.net core開(kāi)發(fā)環(huán)境的方法

    最近想在vs2015體驗(yàn)下.net core,折騰了兩天終于把環(huán)境弄好了。下面這篇文章就給大家分享下我的搭建過(guò)程,有需要的朋友們可以參考學(xué)習(xí),下面來(lái)一起看看吧。
    2016-12-12

最新評(píng)論

西乌| 常山县| 涟源市| 应城市| 安泽县| 伽师县| 兴宁市| 桦川县| 海兴县| 青铜峡市| 浦北县| 同德县| 静乐县| 内丘县| 勃利县| 民丰县| 宝兴县| 闽清县| 晋城| 綦江县| 襄垣县| 攀枝花市| 商河县| 富民县| 山东省| 楚雄市| 宁武县| 荆门市| 瓮安县| 临洮县| 贡山| 固始县| 崇礼县| 佛学| 肃北| 历史| 禹州市| 务川| 容城县| 张家口市| 曲麻莱县|