an ASP.NET Open Source CMS & eCommerce platform
Search:
Skip Navigation LinksHome > DotShoppingCart Forums > Support > Using DotShoppingCart > Dropdownlist with specific roles
Last Post 6/2/2009 2:36:23 PM By lukezy. 5 replies.
6/2/2009 12:47:58 PM
bansal_db
Posts: 181
Joined: 4/13/2009
Dropdownlist with specific roles
Hi Luke,
 
I need to create a dropdownlist with the users that have a specific role.
 
How would i do it since the roles are encrypted in the database?
 
I created a new data source and trying to read the users using linq to sql
 
newCustomerDataSourceDataContext db = new newCustomerDataSourceDataContext(ConfigurationController.SiteConfigurationController.GetSiteConnectionString(SiteNavigation.GetHost()));
           
List<string> SalesRepNames = new List<string>();
           
var q = from d in db.aspnet_UsersInRoles
                       where d.RoleID == "          "
 
 
The underlined part is the problem. I can't campare them directly. How do i use the encrption key?
 
 
Thanks
6/2/2009 1:26:38 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Dropdownlist with specific roles
Why don't you use DSCRole.GetAll() ?
DotShoppingCart Staff
6/2/2009 1:39:37 PM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: Dropdownlist with specific roles
How do I use DSCRole.GetAll()? I am not sure.
 
 
6/2/2009 2:05:49 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Dropdownlist with specific roles
The method will get back all the roles and you will then filter it out any roles at your wish before bind it to the dropdownlist.
DotShoppingCart Staff
6/2/2009 2:10:49 PM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: Dropdownlist with specific roles
Actually I need to get all the users for a specific role, what's the best way to do that?
 
I was thinking of getting the roleID first and then getting the users for that role.
 
What do you think? Is there any method that i can use which already does that?
 
Thanks
6/2/2009 2:36:23 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Dropdownlist with specific roles
You can use Roles.GetUsersInRole.
DotShoppingCart Staff