Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,

am working on asp.net c# sqlserver2005 database.

I want to display First page Textbox value in 2nd page label

I have two pages
1)Registration Page
2)View Details

In first page I have Textbox and submit button
submit button will redirect to page2

I want to show Textbox value in Page2 label

Please help.

Thanks.
Posted
Comments
[no name] 15-May-14 8:24am    
So use a session variable or a query string.

1. on button click write this code
protected void ImageButton1_Click1(object sender, ImageClickEventArgs e)
{
Response.Redirect("page.aspx?id=" + textbox.text);
}


2. On 2ed page get this value using

protected void Page_Load(object sender, EventArgs e)
{
label.text = Request.QueryString["id"];

}
 
Share this answer
 
v2
If you want to display the value of one textbox on another page then QueryString will be a good option. But if you need to display the values of multiple textboxes (controls) then you can use the PostBackUrl property of button. With this you would be able to access all the controls of first page on next page with PreviousPage property.

Please refer the following link to know more about the PostBackUrl property of button.

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.postbackurl(v=vs.110).aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900