By using cross Page Posting We can access controls or properties in the previous page from the current page.
Suppose We have a textbox in Default.aspx named txtName,So create a property returning its text,
we have a hyperlink and its NavigateUrl is default2.aspx.
public string Name
{
get
{
return txtName.Text;
}
}
In Default2.aspx set PreviousPageType in the source,
and in the code behind access the property Name from the first page like this,
<%@ PreviousPageType VirtualPath="~/New/Default.aspx"%>
in the second page.
if (IsCrossPagePostBack)
{
lblName.Text= PreviousPage.Name;
}
Tuesday, January 13, 2009
Cross Page Posting
Category:
.NET,
ASP.NET,
ASP.NET 2.0
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment