I've been reading a few blogs on how to create custom properties in a visual webpart. I've set three values on a dropdownlist and populated the custom property with these values. When I change the values in the dropdownlist inside the properties of the webpart I can change the value of a label to the corresponding value in the dropdown. I did this just to make sure that it works.

Now what I want to do is have two dropdownlists. One will specifcy how many groups will be created and the other dropdownlist will specify what the permissionlevel will be for every group. Is this even possible?

Here is an example of how I populated a custom property.

    public enum EnumProperties
     private EnumProperties _eProperties;
    [Personalizable(), WebBrowsable(true), WebDisplayName("DropDown Property")
    ,Category("Custom Properties"), WebDescription("Property description")]
    public EnumProperties eProperties
    get { return _eProperties; }
    set { _eProperties = value ; }

I hope someone can help and that the question isn't too stupid.


Not sure if this is what you're after, but I built a security report webpart that lets users select what SPBasePermission they want to view using a repeater in the toolpart.

I created a class that the user can interact with in the toolpart:

 public class EditablePermissionsToView
        public bool selected { get; set; }
        public SPBasePermissions permission { get; set; }
        public String color { get; set; }   // in html format
        public string symbol { get; set; }
    List<EditablePermissionsToView> editPermissionsToView;

The follwing code enumarates all the permissions and adds them to the list of available permissions a user can select:

 foreach (SPBasePermissions perm in Enum.GetValues(typeof(SPBasePermissions)))
                    editPermissionsToView.Add(new EditablePermissionsToView { selected = false, permission = perm, color = "#FFFFFF" });


You can then Bind editPermissionsToView to a Repeater (or in your case a dropdown) on the ToolPart

rptPermissions.DataSource = editPermissionsToView;


This is working with Base Permissions, not PermissionLevels, but you could do a similar thing by getting the available permission Levels.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.