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

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

 更新時間: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)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧。
    2018-02-02
  • Asp.Net中索引器的用法分析

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

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

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

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

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

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

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

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

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

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

    ASP.NET中Dictionary基本用法實例分析

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

    asp.net 臟字典過濾問題 用正則表達(dá)式來過濾臟數(shù)據(jù)

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

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

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

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

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

最新評論

石台县| 枣庄市| 志丹县| 剑川县| 乌鲁木齐县| 大城县| 灵山县| 桃园县| 墨脱县| 林周县| 保康县| 建阳市| 博客| 育儿| 彰武县| 新竹县| 大埔县| 平果县| 井冈山市| 西贡区| 海阳市| 黄龙县| 东阿县| 和田县| 苏尼特右旗| 景宁| 吉水县| 盈江县| 亳州市| 陆河县| 桐梓县| 武威市| 通许县| 巴塘县| 元阳县| 博湖县| 洞头县| 南乐县| 柘荣县| 海盐县| 陈巴尔虎旗|