|
Rank: Advanced Member Groups: Member
Joined: 9/13/2007 Posts: 51
|
Hello,
I have two menus on my page (TopMenu, BottomMenu).
What I want to accomplish is this; Use an ajax'd login control (which currently works) and have the menu update to show the items that are allowed for the the roles associated when the user logs in.
The problem is that I have my role information being set within the Global.asax.cs file in the Application_AuthenticateRequest event which does not fire before the menu is created. Basically if I log in, I have to manually refresh the page for the menu items that are roles based to show up.
I know that this is a Page lifecycle thing but I can't seem to find out how to accomplish this and it has been driving me nuts. My whole reasoning behind this is that I don't want a page refresh. I can get it to work by redirecting to the same page after log in, which will re-fire the Application_AuthenticateRequest function and set the roles so that the menu will display the appropriate items.
Is what I am trying even possible?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Please rename your topic title to match the problem. The title is misleading. It appears as if this was a problem of our product, but in fact what you are asking is a generic ASP.NET coding question and it obviously is not a due to a problem of our controls.
What you are trying is possible, but you will need to AJAX enable those two menus as well. The whole flow will be like this:
1. User log in; 2. AJAX calls to the server, set the cookie, comes back to the client; 3. Trigger another AJAX call to the server, this time updates the menus;
The key is you will need to two consecutive AJAX calls. In order to complete step 2, you will need to catch the first AJAX calls "oncomplete" event on the client side. In order to complete step 3, you will need to programmatically trigger the AJAX call with JavaScript. I am not sure how you can do that with ASP.NET AJAX UpdatePanel, but I know you can do that with our CallbackPanel by handling ClientSideAfterUpdate on step 2; and by calling eo_Callback on step 3.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 9/13/2007 Posts: 51
|
Well, first, whenever I have tried to put the menu inside of an update panel and debug the application I get an error and am unable to debug further.
The only way that I can get it to work is if I surround my entire page with an update panel, as opposed to just putting an updatepanel around each menu.
I will attempt the steps that you have outlined,
Thanks!
Afflicted
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Afflicted wrote:Well, first, whenever I have tried to put the menu inside of an update panel and debug the application I get an error and am unable to debug further.
Hi Afflicted, in that case we would expect you to specifically describe the problem, post the related erorr message to match the topic title, as otherwise we will not be able to verify or address it. It is my understanding that our menu does work with ASP.NET AJAX. Afflicted wrote:The only way that I can get it to work is if I surround my entire page with an update panel, as opposed to just putting an updatepanel around each menu. With the solution I outlined, you will need to use multiple UpdatePanel/CallbackPanels. They will need to be updated independently.
|
|