Bind to Roles.GetRolesForUser

  • Thread starter Thread starter mazdotnet
  • Start date Start date
M

mazdotnet

Hi,

I have a GridView that I want to bind user roles to

gvUserRoles.DataSource = Roles.GetRolesForUser("Username");
gvUserRoles.DataBind();

How can access the roles using

<asp:GridView ID="gvUserRoles" runat="server"
AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="Roles">
<ItemTemplate>
Something like this???? <%#
Eval("RoleName")%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

Thanks
M.
 
Hi,

I have a GridView that I want to bind user roles to

gvUserRoles.DataSource = Roles.GetRolesForUser("Username");
gvUserRoles.DataBind();

How can access the roles using

<asp:GridView ID="gvUserRoles" runat="server"
AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="Roles">
<ItemTemplate>
Something like this???? <%#
Eval("RoleName")%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

Thanks
M.

Hi, try <%# Container.DataItem.ToString() %>

http://msdn2.microsoft.com/en-us/library/8h930x07.aspx
 
Back
Top