We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


.NET Show roles in DropDownList within GridView

Medium Priority
Last Modified: 2013-11-26
Hi. I am new to .NET so please be obvious and detailed in your answers!
I am trying to implement both Membership and Roles in a system using SQL Server Express.
Membership so far is working OK. I'm building a web interface to manage the assignment of roles which users belong to.

I want a list of all my users in a GridView - with paging. At the moment, I have their username, email, date created, and an empty dropdownlist showing for all the users, in a paging gridview.

To build on what I currently have, I need three things:

1) Populate the dropdownlist of each row with all the roles in the system
2) Set the dropdownlist to display for each row (or "user") the role they are part of.
3) On changing the dropdownlist, postback and update the roles table accordingly.

Attached is the current code below. I appreciate this is a lot of work so will award points accordingly. I just have no idea about how to go about this.


<asp:GridView ID="EntireUserList" runat="server" AutoGenerateColumns="False" AlternatingRowStyle-BackColor="#BFCFFF" BackColor="White" Width="100%" HeaderStyle-BackColor="#809FFF" HeaderStyle-Font-Italic="False" HeaderStyle-HorizontalAlign="Center" BorderWidth="1" BorderStyle="Solid" BorderColor="Black">
                    <asp:BoundField DataField="UserName" HeaderText="Username" />
                    <asp:BoundField DataField="Email" HeaderText="Email" />
                    <asp:BoundField DataField="CreationDate" HeaderText="Date Created" />
          <asp:TemplateField HeaderText="Assigned Role">
          <asp:DropDownList ID="RoleDropdown" runat="server" AutoPostBack="True"></asp:DropDownList>

Open in new window

Watch Question

Unlock this solution with a free trial preview.
(No credit card required)
Get Preview


perfect! thanks so much!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.