Cross Page Posting!

If you want to pass for example a textbox value from one webform to another, we usually do that using either the query string or the Session variable. ASP.NET 2.0 introduced Cross Page Posting which allow us to retrieve the value of the textbox in the second webform.

Now let's jump to the code.

For this purpose, Create two pages (Page1.aspx, and Page2.aspx)

Page1.aspx will have two controls
 1- A textbox (TextBox1).
 2- A Button (Button1)
 
Set the PostBackUrl property of the Button1 to Page2.aspx.

Now in Page2.aspx page_load event, Write the below code

 TextBox txtFirstPage = (TextBox)(PreviousPage.FindControl("TextBox1"));
 Response.Write(String.Format("You wrote {0} in Page1",txtFirstPage.Text));

When Page2.aspx is loaded, you will see that you were able to retrieve the value you entered on Page1.

Hope this helps,

Published 20 November 2007 09:57 AM by haissam

Comments

# Preriaqueuexy said on 08 March, 2012 07:07 AM

The actual Duchess involving Cambridge continues to be going to colleges inside Oxford, wherever one of several charitable groups the girl helps goes courses for children using behavioral issues.    

The actual Art work Place makes use of treatments to assist children along with issues similar to low self-esteem or perhaps Asperger's Symptoms.    

[url=private equity construction]pimlico college [/url]    

[url=map pimlico]invest in private equity [/url]    

This:

[url=pimlico college]uk private equity companies [/url]    

[url=academy school uk]private equity groups [/url]    

[url=american private equity]sovereign venture capital [/url]    

Your Enjoyment Charitable organisation School aims use a nurturing, secure as well as loving expertise; every single child is inspired to develop strong personal, instructional, actual physical and inventive expertise regarding ongoing learning.

This site

Search

Go

This Blog

Syndication

Sponsors

  • MaximumASP
  • Social Bookmarking
    Online Shopping
    asp.net hosting
    UK online local dating