Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to assign On Page Property on another page in ASP.NET

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?

like image 888
Vijjendra Avatar asked Dec 29 '25 14:12

Vijjendra


2 Answers

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

like image 162
Henry Gao Avatar answered Jan 01 '26 03:01

Henry Gao


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, ...

like image 29
Darin Dimitrov Avatar answered Jan 01 '26 05:01

Darin Dimitrov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!