I am having problems using a LoginView for what I need. Can somebody tell me if I can do this in a LoginView (and how) or if I need to use code-behind.
I have two roles – Administrator and User. I want to dynamically display links based on the role. I will write out what I want in an if statement because it’s easier to explain:
if (role = Administrator) //Display only if administrator. Show Hyperlink 1 Show Hyperlink 2 else if (role = User) //Display only if user. Show Hyperlink 3 Show Hyperlink 4 endif //Display these if a user or if non-authenticated user... Show Hyperlink 5 Show Hyperlink 6 Show Hyperlink 7 endif
Try something like this it uses the
RoleGroupsproperty. You can also specify the RoleGroup for the user, but if you use the LoggedInTemplate it will take affect for all users logged in that don’t have a Group in the RoleGroup. Finally, there isn’t really a way to have a shared template like the scenario you described with Users/Anonymous, so you may have to duplicate. Another possiblity is that you don’t include them in your LoginView and show them to the Administrators as well.