Assuming you have control over the pages that a user redirects to and from, set a Session
variable when you perform an action that your page should base its behavior upon.
For instance, in a LinkButton_Click
event, you could set a Session variable like so:
protected void LinkButton_Click(object sender, EventArgs e)
{
Session["Source"] = "MyLinkButton";
}
And in your page's Page_Load
or Page_Init
event, check the value of that Session
variable and perform the page's change in behavior based on the value in that Session
variable.
protected void Page_Init(object sender, EventArgs e)
{
if (Session["Source"] == "MyLinkButton")
{
// do something
}
else if (Session["Source"] == "SomethingElse")
{
// dome something else
}
}