Jump to content

Asp:rolegroup: Only Pulls First Rolegroup In List


kwilliams

Recommended Posts

I have a very simple page that displays a link for each rolegroup that a member belongs to with ASP.NET membership, lets say Group1 and Group2. For some reason, I can only see the first of two links in a list, regardless of which group it is.I've already verified that both groups are pulling in fine by moving the Group2 link above Group1 to see if it could be viewed: which it was!If Group1 is listed above Group 2, I see the link to Group1. But if I move the link for Group2 above Group1, I see the Group 2 link. I don't have a bunch of snazzy-dazzy complicated code on this page, so I'm stumped. Why could this be happening? I'd appreciate any help. Here is my code:groups.aspx.vb

Partial Class groups	Inherits System.Web.UI.Page	'Pull username	Dim strLoginUserID As String = Context.User.Identity.NameEnd Class

groups.aspx

<%@ Page Language="VB" title="List of Groups" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" EnableSessionState="true" EnableViewState="false" CodeFile="groups.aspx.vb" Inherits="groups" %><asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">	<asp:LoginView ID="LoginView1" runat="server">		<RoleGroups>			<asp:RoleGroup Roles="Group1">				<ContentTemplate>					You are a member of group 1: <asp:HyperLink ID="hlGroup1" NavigateUrl="group1.aspx" runat="server">Group1</asp:HyperLink>				</ContentTemplate>			</asp:RoleGroup>			<asp:RoleGroup Roles="Group2">				<ContentTemplate>					You are a member of group 2: <asp:HyperLink ID="hlGroup2" NavigateUrl="group2.aspx" runat="server">Group2</asp:HyperLink>				</ContentTemplate>			</asp:RoleGroup>		</RoleGroups>	</asp:LoginView></asp:Content>

Link to comment
Share on other sites

I received this response from somewhere else:The LoginView only displays content for the *first* matched RoleGroup, not for all matching groups:http://msdn.microsoft.com/en-us/library/sy...rolegroups.aspxWhat a bummer, huh? So I'm now thinking of dynamically handling the links on the code-behind (show/hide) depending on their roles using the User.IsInRole method, kinda like this:If User.IsInRole("Group1") Then hlGroup1.Visible = TrueElseIf If User.IsInRole("Group2") Then hlGroup2.Visible = TrueEnd IfThanks anyway!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...