这段代码出了什么问题?
源页面:Default.aspx
<form id="form1" action ="Default2.aspx" method="post" runat="server">
<table>
<tr>
<td>Merchant Id</td>
<td><asp:TextBox ID="SRCSITEID" Text="T521" runat="server"></asp:TextBox></td>
</tr>
</table>
<table>
<tr>
<td>
<asp:Button ID="Submit" runat="server" Text="Submit" /></td>
</tr>
</table>
</form>
目标网页:Default2.aspx
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
Default2.aspx.vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
TextBox1.Text = Request("SRCSITEID").ToString()
Catch
End Try
End Sub
答案 0 :(得分:1)
你可以尝试
第1页
Session["someKey"] = ValueFromPage1;
和第2页
var valueFromPage1 = Session["someKey"];
答案 1 :(得分:0)
查看跨页面发布(MSDN Link)
这就像回帖只回到完全不同的页面一样。
示例代码:
If Not Page.PreviousPage Is Nothing Then
Dim SourceTextBox As TextBox
SourceTextBox = CType(PreviousPage.FindControl("SRCSITEID"), TextBox)
If Not SourceTextBox Is Nothing Then
TextBox1.Text = SourceTextBox.Text
End If
End If
答案 2 :(得分:0)
尝试
Request.Form("SRCSITEID")
因为你使用post方法