LoginView.RoleGroups Egenskap
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Hämtar en samling rollgrupper som associerar innehållsmallar med vissa roller.
public:
virtual property System::Web::UI::WebControls::RoleGroupCollection ^ RoleGroups { System::Web::UI::WebControls::RoleGroupCollection ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
[System.Web.UI.Themeable(false)]
public virtual System.Web.UI.WebControls.RoleGroupCollection RoleGroups { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
[<System.Web.UI.Themeable(false)>]
member this.RoleGroups : System.Web.UI.WebControls.RoleGroupCollection
Public Overridable ReadOnly Property RoleGroups As RoleGroupCollection
Egenskapsvärde
Ett RoleGroupCollection objekt som innehåller de definierade rollgruppsmallarna.
- Attribut
Exempel
Följande kodexempel visar hur du RoleGroups använder samlingen. AnonymousTemplate Eftersom egenskaperna och LoggedInTemplate inte har angetts visas innehållet endast för användare som tillhör roller med en definierad innehållsmall.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:LoginView id="LoginView1" runat="server">
<RoleGroups>
<asp:RoleGroup Roles="author">
<ContentTemplate>
<ul>
<li>Add a new article.</li>
<li>Review editorial changes.</li>
<li>View article requests.</li>
</ul>
</ContentTemplate>
</asp:RoleGroup>
<asp:RoleGroup Roles="editor">
<ContentTemplate>
<ul>
<li>Review articles.</li>
<li>Submit edited article.</li>
</ul>
</ContentTemplate>
</asp:RoleGroup>
<asp:RoleGroup Roles="publisher">
<ContentTemplate>
<ul>
<li>Make article request.</li>
<li>Publish reviewed article.</li>
</ul>
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>
</form>
</body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:LoginView id="LoginView1" runat="server">
<RoleGroups>
<asp:RoleGroup Roles="author">
<ContentTemplate>
<ul>
<li>Add a new article.</li>
<li>Review editorial changes.</li>
<li>View article requests.</li>
</ul>
</ContentTemplate>
</asp:RoleGroup>
<asp:RoleGroup Roles="editor">
<ContentTemplate>
<ul>
<li>Review articles.</li>
<li>Submit edited article.</li>
</ul>
</ContentTemplate>
</asp:RoleGroup>
<asp:RoleGroup Roles="publisher">
<ContentTemplate>
<ul>
<li>Make article request.</li>
<li>Publish reviewed article.</li>
</ul>
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>
</form>
</body>
</html>
Kommentarer
Egenskapen RoleGroups innehåller de innehållsmallar som är associerade med olika roller på webbplatsen. Samlingen i RoleGroups egenskapen genomsöks i den ordning som mallar definieras i källan. Den första matchande rollgruppsmallen visas för användaren. Om en användare är medlem i mer än en roll används den första rollgruppsmallen som matchar någon av användarens roller. Om fler än en mall är associerad med en enda roll används endast den första definierade mallen.
Om en inloggad användare inte tillhör någon roll som ingår i rollgruppssamlingen visar webbplatsen innehållsmallen som anges i LoggedInTemplate egenskapen. Anonyma användare visas aldrig någon mall i RoleGroups samlingen.
Du måste konfigurera rollhantering för att använda RoleGroups egenskapen för att definiera mallar baserat på användarens roll på webbplatsen. Mer information finns i Förstå rollhantering.
Den här egenskapen kan inte anges med teman eller formatmallsteman. Mer information finns i ThemeableAttribute and ASP.NET Themes and Skins.