troubleshooting Question

Value Reutrned from aspnet_UsersInRoles_GetRolesForUser

Avatar of Chris Pfeiffer
Chris PfeifferFlag for Japan asked on
.NET ProgrammingASP.NET
8 Comments1 Solution726 ViewsLast Modified:
I am trying to use the following code but it is saying :
Value of type '1-dimensional array of String' cannot be converted to 'System.Web.Security.Roles'

I am at a loss.
' Code To Bind To GridView
   Private Sub bindRoles()
   Dim list As New List(Of Roles)()
        list.Add(Roles.GetRolesForUser(gridUser.SelectedValue.ToString()))
        gvRoles.DataSource = list
        gvRoles.DataBind()
 
    End Sub
 
'Grid View Code
<asp:GridView ID="gvRoles" runat="server" AutoGenerateColumns="False" 
                BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" 
                CellPadding="3"  DataKeyNames="RoleName" 
                GridLines="Vertical">
                <RowStyle BackColor="LightGray" ForeColor="Black" HorizontalAlign="Center" />
                <Columns>
                    <asp:BoundField DataField="RoleName" HeaderText="Roles Of User" />
                    <asp:CommandField HeaderText="Edit" ShowSelectButton="true" />
                </Columns>
                <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
                <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#FFBD1B" Font-Bold="True" ForeColor="White" 
                    HorizontalAlign="Center" />
                <HeaderStyle BackColor="#1C395B" Font-Bold="True" ForeColor="White" 
                    HorizontalAlign="Center" />
                <AlternatingRowStyle BackColor="gray" ForeColor="Black" 
                    HorizontalAlign="Center" />
            </asp:GridView>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros