Transfer textbox value from one page to another

This article simply explains how to transfer textbox values from one page to another. In most cases we have to store the values in Sessions for later use, or pass them through url as querystring. Here we can see how the values can be use in other page without using session or querystring.

Learn Transferring textbox value from one page to another

In most cases we pass the values in url as query string or we have to keep them in session variables. There is a more effective way of accessing the controls in the previous page. Its using the PreviousPage property of the Page. Here explains the usage of PreviousPage property to get the values from previous page.

Transferring textbox value from one page to another steps are as follows;

1.Add two pages default1.aspx and default2.aspx
2.In default1.aspx page add a textbox control and button control.

3.In buttonclick event of default1 page add the code


4.In default2.aspx page, add a label control to display the textbox value from the previous page.

5.inside Page_Load event add the code

TextBox tb = (TextBox)PreviousPage.FindControl("txtTextBoxValue");
lblLabelValue.Text = tb.Text;


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: