views:

55

answers:

3

Hi All, I have a page with name Default.aspx, on Default.aspx I have Property

 protected string pageNo = string.Empty;
 public string PageNo
        {
            get { return pageNo; }
            set { pageNo = value; }
        }

and second page is myPage.aspx have the similar property. Now I want to access the Default.aspx page property on the myPage.aspx or assign it in the myPage.aspx page's property. Is it possible if yes then how to do?

+1  A: 

No, it is not possible. By the time MyPage.aspx is executing, Default.aspx has been garbage collected. Your options are Session variables, Url parameters, ...

Darin Dimitrov
A: 

you are doing cross page posting. you can use page.PreviousPage. It needs from asp.net 3.5 or after.

Henry Gao
A: 

You can use the HttpContext.Items:

Example usage in article:

HttpContext.Items - a Per-Request Cache Store

rick schott