More in this section
Forums / Bugs & Issues / PermissionSet Webcontrol

PermissionSet Webcontrol

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Nige
    Nige avatar
    6 posts
    Registered:
    15 Aug 2007
    07 Feb 2008
    Link to this post
    Hi, I'm currently trying to build a web page to control the Permissions for part of extension to Sitefinity, however I'm running into some issues with the PermissionSet web control. I currently have an aspx page with the control on it and the following code to initialize it.

    public void Page_Load(object sender, EventArgs e) 
        PermissionSet1.Item = new ItemPermissions(); 


    Saving the permissions works, however it crashes on Save with "Cannot have multiple items selected in a DropDownList". I can fix this with a rather nasty hack,

    public void Page_PreRender(object sender, EventArgs e) 
        DropDownList rolesList = PermissionSet1.Controls[0].FindControl("rolesList"as DropDownList; 
        rolesList.SelectedIndex = rolesList.SelectedIndex; 


    but now I have the list being repopulated with the list of roles twice, and each post back caused the list to be populated again and again. It seems that the this control has never been tested directly on a aspx page directly and only the lifecycle of template and containers hides this.
  2. Nige
    Nige avatar
    6 posts
    Registered:
    15 Aug 2007
    07 Feb 2008
    Link to this post
    In the end I worked around the bug with the following code. However it's still a known issue because this code is pretty terrible.
    public void PermissionsUpdated(object sender, EventArgs e) 
        DropDownList rolesList = PermissionSet1.Controls[0].FindControl("rolesList"as DropDownList; 
     
        int currentItemCount = rolesList.Items.Count; 
        int desiredItemCount = currentItemCount / 2; 
     
        for(int i = desiredItemCount; i < currentItemCount; i++) 
        { 
            rolesList.Items.RemoveAt(desiredItemCount); 
        } 

2 posts, 0 answered