Results 1 to 1 of 1
2006-06-19, 20:19 #1
- Join Date
- May 2006
- Thanked 0 Times in 0 Posts
Dynamic changes to Master Pages (VB.NET)
In the traditional "completely backwards" style, I have now decided that the site I am doing needs to be fitted into master pages. Good idea, but the implementation has been a bit rough. In its basic form, things are going well, I have no problem referencing which master page to use, and items show up in the appropriate spots. However, one of the areas of my master page will be used to display a list of links, or more appropriately, user options. After checking the database, it will be determined which links will be shown depending on the rank of the user visiting the site. (Other security measures are used of course, but this is just from a usability standpoint)...
My original thought was just to do this checking in the masterpage.vb file. Then, I could switch visibility of the appropriate panels on or off. But, even though I am using forms authentication, I get errors that "User" is undefined (I commonly use User.Identity.Name throughout the site)... From this point I really don't know where to go-- I attempted to do the checking in the content page's .vb file and then just reference a panel within the master page...
Dim thisPanel As Panel = CType(Master.FindControl("adminPanel"), Panel)
Of course, this comes back as Object reference not set to an instance of an object... hmm.
So, short of stuffing the links into this content section dynamically (doing the checking in every single content page and copying and pasting), I am not sure what will work for me... I know this solution is not the best, so I am trying to avoid it.
It seems very close, I just need to know what I am missing, or at least how to manipulate items in a master page via a content page! (or how to access my all-important User.Identity.Name variable!)