473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Bind to Roles.GetRolesForUser

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.

Sep 13 '07 #1
1 2301
On Sep 13, 2:43 am, mazdotnet <maflat...@gmail.comwrote:
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

Sep 13 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Steven Blair | last post by:
I am writing an application using the ASP.NET Configuration Roles and Users. The problem I have, in my C# I need to work out which type of user just logged in. I am currently using: string...
1
by: Jonathan Woods | last post by:
Hi there, Please find file for illustrating infrastructure --> http://test.thipparath.com/GPRS/GPRS.jpg . Gateway receives packets from Trucks for processing Route/GPS position. When Truck and...
7
by: Ben R. | last post by:
Hi, The documentation for RoleProvider.IsUserInRole states: "The IsUserInRole method is called by the IsUserInRole method of the Roles class and the IsInRole method of the RolePrincipal class...
2
by: Jules | last post by:
When creating this website I user a custom authentication method to validate the usercredentials (I think the membership provider is an overkill since I only use the authentication part). When I...
1
by: xeroxero | last post by:
What is the fastest way to enumerate roles for an ASP.NET 2.0 user? Authentication and authorization has occurred, and roles have been assigned to my (Generic)Principal. I just want to list them to...
4
by: AC | last post by:
Hi there. My asp.net 2.0 development website uses roles to control access to sections of my site, configured using the asp.net configuration tool, which is great. Except that isn't available once...
2
by: Jonathan Wood | last post by:
I've set up ASP.NET membership. I can get the role(s) of the current user by calling Roles.GetRolesForUser(). It seems like it would be a good idea to store some role-specific calculations in...
2
by: Nathan Sokalski | last post by:
When I call System.Web.Security.Roles.GetRolesForUser() it returns no results even though I have roles associated with the currently logged in user. I am able to get the username by calling...
2
by: Nathan Sokalski | last post by:
When I call System.Web.Security.Roles.GetRolesForUser() it returns no results (an array of length 0) even though I have roles associated with the currently logged in user. I am able to get the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.