在ASP.NET Web窗体中将角色列添加到DataGrid

时间:2015-08-25 14:50:22

标签: c# asp.net datagrid user-roles

我在ASP.NET中有Web表单,我希望在其中显示包含我的应用程序中所有用户的表格。应该有用户名,用户电子邮件,上次活动日期和用户角色。

目前我有这个:

<asp:DataGrid id="UserGrid" runat="server"
            CellPadding="2" CellSpacing="1"
            Gridlines="Both" AutoGenerateColumns="false">
  <Columns>
    <asp:BoundColumn DataField="UserName" ReadOnly="False" HeaderText="Name" />
    <asp:BoundColumn DataField="Email" ReadOnly="True" HeaderText="Email" />
    <asp:BoundColumn DataField="LastActivityDate" ReadOnly="True" HeaderText="Last activity"/>
</Columns>
<HeaderStyle BackColor="darkblue" ForeColor="white" />

</asp:DataGrid>

_

UserGrid.DataSource = Membership.GetAllUsers();
UserGrid.DataBind();

我想向此DataGrid添加列角色。我怎么能这样做?

在下一步中,我想添加带有按钮的列来编辑用户信息,管理他的角色等。

0 个答案:

没有答案