例:A網頁 -->B網頁
A.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="A.aspx.vb" Inherits="A" %> ..... ..... ..... |
B.aspx.vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Page.PreviousPage IsNot Nothing Then Dim textValue as String = Ctype(PreviousPage.FindControl("TextBox1"),TextBox).Text End If End Sub |
2.送出按鈕做了前端 (javascript)及後端Button.Click的檢查後將表單傳送至下一頁的做法。
例:A網頁(含檢核)-->B網頁
A.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="A.aspx.vb" Inherits="A" %> ..... ..... <form id="frm" name="frm" runat="server"> <asp:TextBox ID="TextBox1" runat="server" /> <asp:Button ID="Button1" runat="server" PostBackUrl = "B.aspx"/> ..... ..... |
A.aspx.vb
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click If XXXXX Then ......... '傳送至下一頁 RegisterStartupScript("Page", "") Else '顯示錯誤訊息 RegisterStartupScript("Page", "") End If End Sub |
B.aspx.vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Page.PreviousPage IsNot Nothing Then Dim textValue as Stringn = Ctype(PreviousPage.FindControl("TextBox1"),TextBox).Value End If End Sub |
沒有留言:
張貼留言