Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
i am using Create user wizard (Built-in) , in this wizard i have also create a step for
"Choose your role". now i want to retrieve all role into me list box. what should i need to do.
C#
listbox.dataSource = ???
Posted

1 solution

You can do like below :

C#
private void BindRolesToList()
{
     // Get all of the roles
     string[] roles = Roles.GetAllRoles();
     UsersRoleList.DataSource = roles;
     UsersRoleList.DataBind();
}


For more information check this :

Assigning Roles to Users[^]

Update : using System.Web.Security;


I hope this will help to you.
 
Share this answer
 
v3
Comments
Thanks7872 9-Jul-13 4:55am    
Excellent..↑voted..
Muhamad Faizan Khan 10-Jul-13 1:07am    
Role keyword is not appearing in my intellisence. Am i missing and name space reference?
Muhamad Faizan Khan 10-Jul-13 1:16am    
oh i got it
using System.Web.Security;
Sampath Lokuge 10-Jul-13 2:43am    
Yup.I have updated it on my solution also.If this solution helps to you then accept as answer.It may be helped others to quickly identify the solution in future.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900