I have method that I am using to check the access of certain controls. For some reason, when I put breakpoints in the HasAcess method, I only see hit it once, where I am using it several areas in the page. Any Ideas. I feel really dumb asking this question. It seems to be very obvious.
ASPX Page:
<asp:CheckBox ID="chkIncludeVersions" runat="server" Text="Search Versions" Visible='<%# TR.Utility.HasAccess("ugEpisodeVersionsView")%>' />
Code Behind:
public static Boolean HasAccess( string access)
{ // Breakpoint
string userGroup = HttpContext.Current.Session["UserGroup"] as string;
List<string> groupsAccess = new List<string>( ((string)Settings.Default.Properties[access].DefaultValue).Split(','));
return groupsAccess.Contains(userGroup);
}
I knew it was something very stupid. all I had to do is add Page.DataBind(); in the code behind.