none
Using a combo box in the property page for edit web part

    Question

  • I have this definition
        [WebBrowsable(true),
        WebDisplayName("Vendor Id"),
        WebDescription("Enter the Vendor Id"), 
        DefaultValue(""),
        Personalizable(PersonalizationScope.Shared )] 
        public string VendorId { get; set; }
    

    But I would like the input box that appears in the edit window of sharepoint when in editing maode for a web part page to be a ListBox or a DropDownList control. Is this possible?

     

    Nick

    Thursday, January 13, 2011 12:24 AM

Answers

  • You need to create custom tool part for SharePoint. Because i don't think sharepoint web part framework supports web part property of type drop-down out-of-box.

    Please refer the following blog entry on the same.

    http://www.mstechblogs.com/sundar/create-custom-tool-parts-for-sharepoint-web-parts/


    Sundar Narasiman
    • Marked as answer by nick5454 Thursday, January 13, 2011 10:26 PM
    Thursday, January 13, 2011 4:49 AM
  • Incidentally, if the type of your web part property is an enum then SharePoint uses a drop-down out-of-the-box to display the options. However, this requires you to hard code your possible values. ToolPart inherits from EditorPart - ToolPart is in Microsoft.SharePoint.WebPartPages, the more generic EditorPart is in System.Web.UI.WebControls.WebParts - they both serve the same purpose AFAIK.

    • Marked as answer by nick5454 Thursday, January 13, 2011 10:26 PM
    Thursday, January 13, 2011 5:19 AM

All replies