I have a Master page having title and menu, now i want if i open login.aspx page, the menu of the master page should be hided, rest title will remain there, means master page is required but without menu, what is the best solution for this?
相关问题
- Carriage Return (ASCII chr 13) is missing from tex
- How to know full paths to DLL's from .csproj f
- How to store image outside of the website's ro
- Importing NuGet references through a local project
- Visual Studio 2019 - error MSB8020: The build tool
相关文章
- asp.net HiddenField控件扩展问题
- asp.net HiddenField控件扩展问题
- Asp.Net网站无法写入错误日志,测试站点可以,正是站点不行
- asp.net mvc 重定向到vue hash字符串丢失
- FormsAuthenticationTicket expires too soon
- How to show location of errors, references to memb
- “Dynamic operations can only be performed in homog
- What is the best way to create a lock from a web a
Get the menu control and set its Visible property to false Warning: this good is finding control with hard coded ID so it may trow NullReferenceException
You can have a property to show or hide menu in the master page.
like
Note: if the menu is static, you can surround it in PlaceHolder control and manage showing/hiding it using this control. I chose this specific control to suggest as it doesn't render extra HTML so, nothing changes in page.
.
Then in the login page, say Page Load or something (not in pre init or such early times, to have master page created already):
.
Update
Another way to solve this is to have nested master-pages. The child master page has the menu and other stuff and is the default master-page for all pages. The parent master-page has all the important stuff that applies even to the login page.
If you already have a master page, you can create another one, move most stuff to the other one from your existing master page, use the same IDs for content place holders, and then make the existing master-page itself have an masterpage file set to the new one, and then it should be easy to go to login page and also change the master-page file name to the new master-page file.
You can do like the following. Put this in master page's code behind.