Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
in SharePoint Server by 35 45 53
Is it possible to create a custom property as a dropdown list in SharePoint Visual WebPart? I just can create a textbox custom property but I can't create a Combobox with selection as a custom property in Visual WebPart, How to do that?

1 Answer

1 like 0 dislike
by 155 174 350
selected by
Best answer

Dropdown list Custom Property in Visual WebPart

You can create a dropdown list as a custom property in Visual WebPart by defining your list as an enumeration as shown below

public enum customProperyList { Select,List1, List2, List3 };
public customProperyList  _list;

  WebDisplayName("My List"),
  WebDescription("Select from your list"),
  System.ComponentModel.Category("Mail Settings"),

   public customProperyList  _List
           get { return _list; }
           set { _list = value; }


combobox custom propery in visual webpart sharepoint 2019

See also, How to create a Custom Property in Visual WebPart?

If you don’t ask, the answer is always NO!