ASP.NET how to access public properties?

前端 未结 5 706
难免孤独
难免孤独 2020-12-12 08:06

I have two pages page1.aspx and page2.aspx, both have code behind with partial classes. How do i access public property message on page1.aspx from page2.aspx ?



        
5条回答
  •  清歌不尽
    2020-12-12 08:36

    If you want a message property on every page. You could implement your own BasePage and define the message property in your base page. Then derive subsequent pages from your custom base page. That way all of your pages will always have a message property.

    However, this isn't going to keep the message property constant through out each page. If you are trying to pass values between pages then you should use either session state or a querystring

    This MSDN page may be of use to you.

提交回复
热议问题