Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > 2 repeaters and 2 roles View modes: 
User avatar
Member
Member
Aon_Vlado - 1/18/2012 8:14:46 AM
   
2 repeaters and 2 roles
I have in my Master Page 2 Repeaters to show 2 different menus for 2 different user groups. I have also a web part which changes the current user role from one to the other one when click on a button – this works correctly and I can see in debug as well as in db that the roles changed correctly.


CMS.SiteProvider.UserInfoProvider.AddUserToRole(user.UserName, "SponsorAsParticipant", CMS.CMSHelper.CMSContext.CurrentSiteName.ToLower());
CMS.SiteProvider.UserInfoProvider.RemoveUserFromRole(user.UserName, "Sponsor", CMS.CMSHelper.CMSContext.CurrentSiteName.ToLower());


However repeaters do not switch: after switching role I should see the second (different) repeater. Cash of the repeaters is set to 0.
What am I doing wrong?

User avatar
Member
Member
kentico_michal - 1/19/2012 2:55:31 AM
   
RE:2 repeaters and 2 roles
Hello,

The problem seems to be in fact that the Repeater control evaluates the role of the current user before the OnClick handler of the button is executed and therefore, before the role of the current user is changed.

So, you can work around this problem by redirecting to the same page after you change the role of the current user: URLHelper.Redirect(URLHelper.CurrentURL);

Best regards,
Michal Legen

User avatar
Member
Member
Aon_Vlado - 1/19/2012 6:46:00 AM
   
RE:2 repeaters and 2 roles
I do not think this would be the case. The first Repeater stays there even when I go to a different document under the same Master Page. It should show the second Repeater because the role of the current user changed. It looks like cash issue, but like I said cashing of repeaters is set to 0.

User avatar
Member
Member
kentico_michal - 1/22/2012 6:14:29 AM
   
RE:2 repeaters and 2 roles
Hello,

What about the full output caching? Are you using it?

What happens if you refresh the page?

Could you please enable tha cache items debug to see if either the output of the repeaters or the rendered content of the page is cached: Cache items debug, Cache debugging.

Best regards,
Michal Legen