How to set Page's Title from a web content page in ASP.NET 3.5

后端 未结 7 1463
长情又很酷
长情又很酷 2021-02-15 07:52

I\'ve read through quite a bit of posts/articles on how to do this and I still am not getting the page title set from the content page. My pages render OK except I can\'t get th

7条回答
  •  太阳男子
    2021-02-15 08:36

    You have to remember that the MasterPage is a child control of the Page, so the OnLoad event fires after the Page's OnLoad event.

    In your scenario/example, the page would set the title, then the masterpage would set it again afterwards. Either set it later in the lifecycle or wrap some more logic around who sets it perhaps?

    Scott Allen has a good article on this for Master Page's specifically, give it a quick read to get a feel for the lifecycle order.

提交回复
热议问题