How would I add a user to a role in (c#)

I'm trying to add a user to a row with the role manager but can't get it to work.  I would like the admin to be able to add role to users as needed.  I can't figure the code out.

this is what I have.  I have a gridview with the name of the user in it, when they click the button it put the user name in a label that i would like to use to assign the row to with my dorpdownlist of Roles.

Membership.ApplicationName = AppName.Text.ToString();
Roles.AddUsersToRole(selUser.Text, atRole.Text);

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dhanasekaran SengodanCommented:
Great question! The most simple answer is to use the Web Site Administration Tool ASP.Net provides:

After getting intitial testing out of the way, you undoubtedly will want to do this programmically. You can do this by calling Membership.CreateUser() as follows:

       out createStatus);

Open in new window

Also refer this link :

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bmanmike39Author Commented:
Thank you!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.