共用方式為


RoleGroupCollection.Add(RoleGroup) 方法

定義

將角色群組加入集合的結尾。

public:
 void Add(System::Web::UI::WebControls::RoleGroup ^ group);
public void Add (System.Web.UI.WebControls.RoleGroup group);
member this.Add : System.Web.UI.WebControls.RoleGroup -> unit
Public Sub Add (group As RoleGroup)

參數

group
RoleGroup

要加入至集合的 RoleGroup

範例

下列程式代碼範例會將動態建立 RoleGroup 的物件新增至 RoleGroupCollection。 此程式代碼範例是針對 類別提供的較大範例的 RoleGroup 一部分。

RoleGroup rg = new RoleGroup();
rg.ContentTemplate = new CustomTemplate();
String[] RoleList = {"users"};
rg.Roles = RoleList;
RoleGroupCollection rgc = LoginView1.RoleGroups;
rgc.Add(rg);
Dim rg As New RoleGroup
rg.ContentTemplate = New CustomTemplate
Dim RoleList(1) As String
RoleList(0) = "users"

rg.Roles = RoleList

Dim rgc As RoleGroupCollection = LoginView1.RoleGroups
rgc.Add(rg)

適用於

另請參閱