Welcome Guest Search | Active Topics | Sign In | Register

Menu, SiteMaps, Roles and Postback Options
patingamon
Posted: Friday, November 30, 2007 4:58:06 AM
Rank: Member
Groups: Member

Joined: 9/6/2007
Posts: 29
I am using the EO Menu with it's datasource tied to an XML Sitemap. The Roles are defined within the sitemap. Here is a snippet:

Code: XML
<siteMapNode title="Home">
    <siteMapNode title="Admin Dashboard" url="~/App/adminHome.aspx" roles="admin_role"  />
    <siteMapNode title="Config" url="~/App/Config.aspx" roles="admin_role"  />
    <siteMapNode title="About Us" url="~/App/About.aspx"  />
</siteMapNode>


On one of my pages I can change the role, and the process of changing the role initiates a postback. The event that changes the role is processed as follows:

Code: C#
protected void ddRole_SelectedIndexChanged(object sender, EventArgs e)
{
    this.RoleID=this.ddRole.SelectedRoleID;
}


The problem is that when the postback finishes, the menu does not always reflect the new role.
-- If I am an Admin and change to a more restrictive role (ie, no longer an Admin)
the menu choices disappear. This is expected behavior.

-- But if I came in as not an Admin and changed to an Admin
the Admin menu choices still do not appear unless I go to a different page. This
is not expected behavior

Any ideas?
eo_support
Posted: Friday, November 30, 2007 6:39:54 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

My guess is that the menu has already been populated (or regenerated from view state) when you change your role ID. Try to call Menu1.DataBind() to force a data bind after you change role ID to see if it helps. You may also want to do a Redirect to yourself to make sure everything is refreshed. Quite some other things are already constructed by ASP.NET based on your previous authentication cookie before you change role ID, so it's always a good thing to do a Redirect after the role changes to make sure everything is refreshed. That's why by default ASP.NET form authentication always redirects to "ReturnUrl" after you login.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.