none
WebBrowsable Properties of WebPart not shown.

    Question

  • Hi all,

    In need to support something in a SharePoint 2007 I have developed a WebPart. This is a visual web part created in Visual Studio 2010. I have made all the necessary changes in order to get my WebPart to be deployed in SharePoint 2007, BUT I cannot see the WebBrowsable Properties I have defined in the properties panel of the WebPart

    The code for defining the Property in the UserControl created by Visual Studio is the following: 

    private const string CUSTOM_DEFAULT = "DEFAULT";
    private string m_Custom = CUSTOM_DEFAULT;
    
    [WebBrowsable]
    [Category("Miscellaneous")]
    [Personalizable(PersonalizationScope.Shared)]
    [WebDescription("Custom Property")]
    [WebDisplayName("Text")]
    public string Custom
    {
        get { return m_Custom; }
        set { m_Custom = value; }
    }

    my WebPart Code is the following:

    using System.Web.UI;
    
    namespace TestWebPart.TestWP
    {
        public class TestWP : System.Web.UI.WebControls.WebParts.WebPart
        {
            // Visual Studio might automatically update this path when you change the Visual Web Part project item.
            private const string _ascxPath = @"~/_CONTROLTEMPLATES/TestWebPart/TestWP/TestWPUserControl.ascx";
    
            protected override void CreateChildControls()
            {
                Control control = Page.LoadControl(_ascxPath);
                Controls.Add(control);
            }
        }
    }

    What am I doing wrong with all that? I' ve tried numerous suggestions like changing the attributes for the browsable property, adding XMLRoot Namespace in WebPart class but none of the worked and I'm in despair! If anyone can help me I'll be grateful.

    Thanks in advance! 

    Wednesday, December 18, 2013 6:23 PM

All replies

  • Those properties need to be defined in the Web Part class.

    Dimitri Ayrapetov (MCSE: SharePoint)

    Wednesday, December 18, 2013 11:28 PM