tags:

views:

32

answers:

2

Hi All,

I have a page which has a panel whcih contains various buttons to load different pages. I have two butons in that panel one is "Search Products" and one is "Add Product". When i click Add Product it loads the corresponding page , on this page I have a button which takes me back to Serach Products page , now I want to know somehow that this page(Search Products) is opened from Add Products coz then I have to enable some buttons on Search Products page , and if i go directly to Search Page by clicking panales's button then I don't want to enable those buttons.

I didn't find anything , please anyone help me out.

A: 

You can use a value in Context to achieve this. Just before leaving to the target page from the current page add this

Context.Items["PageOpener"] = "AddProduct.aspx";

and check whether this context is null or not in the target page. If it is null then the page is not loaded from the first page.

This can be used when you are doing Server.Transfer from the page.

rahul
thanx , phoenix
Praveen
A: 

use request.urlReferrer, put this in the hidden field when page is load, like....

if (!Page.IsPostBack)
    {
        hdfRefrerPath.Value = Request.UrlReferrer.PathAndQuery.Substring(Request.UrlReferrer.PathAndQuery.LastIndexOf("/") + 1);
    }

and then use where you want........where hdfRefrerPath is hidden field.

Muhammad Akhtar