开发者

how to transfer textbox1 value from default1.aspx to textbox1 of default2.aspx in hidden parameters?

开发者 https://www.devze.com 2023-02-14 10:41 出处:网络
I have two webpage in my website namely Default.aspx and Default2.aspx I have asp.net textbox1 and button1 inside Form tag in Default.aspx page

I have two webpage in my website namely Default.aspx and Default2.aspx

I have asp.net textbox1 and button1 inside Form tag in Default.aspx page

and开发者_如何学Go i have textbox1 inside form tag in Default2.aspx page

i want when i wanna transfer the textbox1 text of default.aspx page into default2.aspx textbox1 text hidden parameters ... which will not show query string in address bar and transfer value from one page to another..

how to do this ...


use PreviousPage.FindControl


You can use something called Cross-Page Posting . Look at the example Here

If Not Page.PreviousPage Is Nothing Then
Dim SourceTextBox As TextBox
SourceTextBox = CType(PreviousPage.FindControl("TextBox1"), _
    TextBox)
If Not SourceTextBox Is Nothing Then
    Label1.Text = SourceTextBox.Text
End If

End If

Make Sure you post back to Different page like this:

<asp:Button   ID="Button1" PostBackUrl="~/TargetPage.aspx" runat="server"  Text="Submit" />
0

精彩评论

暂无评论...
验证码 换一张
取 消