hgs yükleme
My Cart (0)  |  My Orders  |  My Downloads  |  My Auction  |  My Account  |  Help


Login |Register        Search

How to bind user roles of DotNetNuke Site in a Page

                Print      Add To Favorite     Add To Watch List     Contact Author

Creator: host   8/27/2012 10:47:07 PM    Author: Sibabrata Dash   Source: http://www.mindfiresolutions.com/Bind-All-User-roles-of-DotNetNuke-Site-in-a-Page-1064.php   Views: 2281    0    0  
Tags:
Login Module develop User Role Permission Dotnetnuke

In DotNetNuke there is a class RoleController present inside DotNetNuke.Security.Roles namespace, using which we can extract all the user roles present in our DotNetNuke website..
 
For example I am writing code for adding all existing user groups to the checkboxlist below:
 
test.ascx page: Added a check list box -
 
<asp:CheckBoxList ID = "chkListUserRoles" runat = "server" DataValueField = "roleId" DataTextField = "roleName" CssClass = "Normal">
</asp:CheckBoxList>
 
test.ascx.cs page-
 
- Include DotNetNuke.Security.Roles namespace.
 
          using DotNetNuke.Security.Roles;
 
- Create an object of RoleController, then store all roles in an array variable.
          
     RoleController objRoleController = new RoleController();
     ArrayList objRoles = objRoleController.GetPortalRoles(this.PortalId);
 
- Then bind all the users to the checkboxlist object to display all users present in DNN site.
              
          chkListUserRoles.DataSource = objRoles;
          chkListUserRoles.DataBind();
 
In this way we can show all available roles in module settings page for giving permissions to certain user group to access our module.


Rating People: 8   Average Rating:     

     DnnModule.com is built to provide DNN quality modules and DNN skins, some of them are free, some not. We wish these stuffs (free or not ) can be useful to you.

     Besides that, we also provide a full range of professional services, ranging from web site build, seo, system management, administration, support, senior consultancy and security services. We act as if your development project or network was ours, with care and respect. We are not satisfied until it works the way you want it to, and we don't silently ignore found issues as somebody else's problem.