"You can determine if a page is being loaded as a result of a cross postback by checking the PreviousPage object. A null value indicates a regular load, while a null value signals a cross postback."
Which begs the question, what if there's a null value instead?
Discussion on:
View:
Show:
The Page class exposes a property named PreviousPage. If the source page and target page are in the same ASP.NET application, the PreviousPage property in the target page contains a reference to the source page. (If the page is not the target of a cross-page posting, or if the pages are in different applications, the PreviousPage property is not initialized.) By default, the PreviousPage property is typed as Page.
You are not constrained to just the asp:button class.
The other button types of asp:imagebutton and asp:linkbutton also support the features that Tony has described in this great article.
Rod
The other button types of asp:imagebutton and asp:linkbutton also support the features that Tony has described in this great article.
Rod
Source page : source.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="source.aspx.cs" Inherits="source" <>
. . .
void Page_Load(object sender, System.EventArgs e)
{
if (IsCrossPagePostBack)
. . .
object x = (Object)PreviousPage.FindControl("TextID");
. . .
}
Why press Button (ID="return") on source page, source.aspx, the target page, target.aspx, load on locally/refresh on the source page, but NOT show/display on another new page?
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="source.aspx.cs" Inherits="source" <>
. . .
void Page_Load(object sender, System.EventArgs e)
{
if (IsCrossPagePostBack)
. . .
object x = (Object)PreviousPage.FindControl("TextID");
. . .
}
Why press Button (ID="return") on source page, source.aspx, the target page, target.aspx, load on locally/refresh on the source page, but NOT show/display on another new page?
i need code add comment to my site please help topsokdna@gmail.com
- Keyboard Shortcuts:
- Prev
- Next
- Toggle









































