I'm looking for a server side event that will fire after the menu has been rendured in the master page but before control is passed to the main page. So effectively before OnLoad.
Any suggestions?
The application is translating a website built with MS tools and they filter the menu system based on the logged in user on the computer.
Thanks!
6 Answers, 1 is accepted
Hello Bernie,
If you set the Visible property of the MenuItem, then it will never be rendered on the client.
- https://www.telerik.com/support/kb/aspnet-ajax/menu/details/how-do-i-load-different-menus-based-on-different-user-roles-
- https://www.telerik.com/support/kb/aspnet-ajax/menu/details/hide-menu-items-when-the-user-must-not-see-them
With that said, even if you set the .Visible property of the items in any PageLoad event, the Item will not be sent to the client.
Regards,
Peter Milchev
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.
That would be fine. That's the objective of the code. Only show the menu items the user is allowed to see.
My question is, is there an event that fires at the end of the master page but before the child page starts
Hello Bernie,
The ContentPage's Page_Load is fired before the MasterPage's Page_Load. After the MasterPage's Page_Load is fired the RadMenu's OnLoad event is fired (the menu is in the MasterPage).
- Page_Load from ContentPage
- Master Page_Load
- RadMenu Load from Master
- ContentPage Page_LoadComplete
Regards,
Peter Milchev
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.
"... I am not quite sure why such an event is needed ..."
I'm refactoring someone else's code. They have the menu modification code in every page on the website. I'd like to move that code to the Master page so it only appears once. That code needs to be run after the menus are instantiated, but still in the Master page. Hence the need for some event that I can hook.
Thank you for the list of operation;
1. Page_Load from ContentPage
2. Master Page_Load
3, RadMenu Load from Master
4, ContentPage Page_LoadComplete
I'm looking for an event to hook between items 3 and 4.
Hello Bernie,
As the MasterPage does not have a Page_LoadComplete event, you can either use the Page_Load of the MasterPage itself or the Page_PreRender of the MasterPage.
- https://forums.asp.net/t/1030769.aspx?Do+Mater+Pages+Have+A+Page_LoadComplete+Event
- https://docs.microsoft.com/en-us/previous-versions/ms178472(v=vs.140)?redirectedfrom=MSDN
As you can see, the RadMenu's Load event is after the ContentPage's Load event, you can use this event also.
Regarding the events between the inner control's Load event and the ContentPage's LoadComplete, I am not quite there is such an event.
Regards,
Peter Milchev
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.
In case anyone comes along that needs this. I found that Page_PreRender does the job for me. It fires after all the controls on the master page are instantiated but obviously before it renders. A couple of good references on master and content page events are;
https://www.c-sharpcorner.com/blogs/sequence-of-events-in-master-and-content-pages1
https://www.red-gate.com/simple-talk/dotnet/asp-net/asp-net-master-pages-tips-and-tricks/
https://odetocode.com/articles/450.aspx