How to determine which Child Page is being displayed from Master Page?

前端 未结 16 691
一生所求
一生所求 2021-02-02 10:26

I\'m writing code on the master page, and I need to know which child (content) page is being displayed. How can I do this programmatically?

16条回答
  •  走了就别回头了
    2021-02-02 10:57

    so many answers I am using

    <%if(this.MainContent.Page.Title != "mypagetitle") { %>
    <%}%>
    

    this makes it easy to exclude any single page and since your comparing a string you could even prefix pages like exclude_pagetitle and comparing a sub-string of the title. I use this commonly to exclude log in pages from certain features I don't want to load like session timeouts and live chat.

提交回复
热议问题