How cross page posting is done in Asp.net 2.0?

Answer Posted / abhishek kumar

cros page posting is page to page data transfer machanism
like query string.

you can do it two ways :

1. using <%@ PreviousPageType VirtualPath="~/
SourcePage.aspx" %> directive :- If the target page
contains a PreviousPageType directive that points to the
source page, you can access the source page's CurrentCity
property using code such as the following.

Label1.Text = PreviousPage.CurrentCity;

2. Using PostBackUrl and PreviousPage property :-

In source page specify PostBAckUrl property to control
which you use to generate postback like,

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

In TargetPage.aspx :-

if (Page.PreviousPage != null)
{
TextBox SourceTextBox =
(TextBox)Page.PreviousPage.FindControl("TextBox1");
if (SourceTextBox != null)
{
Label1.Text = SourceTextBox.Text;
}
}

Is This Answer Correct ?    13 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many ways are there to maintain a state in .net? What is view state?

592


What are user controls?

572


Explain About duration in caching technique

623


What do you mean by role-based security?

569


How would you create a permanent cookie?

573






8. Why do you want to work here?

1484


How is my content secured from unauthorized access?

519


How do you handle server controls?

660


What is an il?

566


What is cached data phone?

531


Explain what are delegates?

582


What are the different session state management options available in asp.net?

522


can we remote debug applications with the remote debugger installed with vs.net 2002, with vs.net 2003?

1754


What is the difference between an htmlinputcheckbox control and an htmlinputradiobutton control?

623


How can we access static variable?

651