I have a page with name Default.aspx, on Default.aspx I have Property
我有一个默认名称的页面。aspx,违约。aspx我有财产
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?
第二页是myPage。aspx具有相似的属性。现在我要访问默认值。在myPage上的aspx页面属性。aspx或在myPage中分配它。aspx页面的属性。如果可以,那怎么做呢?
3 个解决方案
#1
1
you are doing cross page posting. you can use page.PreviousPage. It needs from asp.net 3.5 or after.
你在做跨页张贴。您可以使用page.PreviousPage。它需要从asp.net 3.5或以后。
#2
1
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, ...
不,这是不可能的。的时候MyPage。aspx执行,违约。aspx已被垃圾收集。您的选项是会话变量、Url参数……
#3
0
You can use the HttpContext.Items:
您可以使用HttpContext.Items:
Example usage in article:
条使用例子:
HttpContext.Items - a Per-Request Cache Store
HttpContext。项——一个请求的缓存存储。
#1
1
you are doing cross page posting. you can use page.PreviousPage. It needs from asp.net 3.5 or after.
你在做跨页张贴。您可以使用page.PreviousPage。它需要从asp.net 3.5或以后。
#2
1
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, ...
不,这是不可能的。的时候MyPage。aspx执行,违约。aspx已被垃圾收集。您的选项是会话变量、Url参数……
#3
0
You can use the HttpContext.Items:
您可以使用HttpContext.Items:
Example usage in article:
条使用例子:
HttpContext.Items - a Per-Request Cache Store
HttpContext。项——一个请求的缓存存储。