Sharepoint custom web part property does not show up in the toolbox

后端 未结 3 1507
挽巷
挽巷 2021-02-19 13:33

I have defined a boolean property as follows:

 [Browsable(true), Category(\"Display\"), DefaultValue(false),
  WebPartStorage(Storage.Shared), FriendlyName(\"Obe         


        
相关标签:
3条回答
  • 2021-02-19 14:07

    @Jason, you're correct. The syntax "Browsable", and "Category" are Sharepoint 2003 specific. For SharePoint 2007, it's "WebBrowsable", and "SPWebCategoryName" respectively.

    DefaultValue(false) is also SharePoint 2003 specific.

    The equivalent in 2007, as far as I know, is to declare it initially beforehand, like this:

        private string _strMainFolder = "Reports"; //Here is the default value
    
        [WebBrowsable(true)]
        [WebDisplayName("SharePoint List Name")]
        [SPWebCategoryName("SharePoint List Name Settings")]
        [WebPartStorage(Storage.Shared)]
        [WebDescription("You would put the description here.")]
        [Personalizable(PersonalizationScope.Shared)]
        public string strMainFolder
        {
            get { return _strMainFolder; }
            set { _strMainFolder = value; }
        }
    
    0 讨论(0)
  • 2021-02-19 14:14

    You are on the right track. You just need to use different attributes.

    [Personalizable(PersonalizationScope.Shared)]
    [WebBrowsable(true)]
    [Category("Display")]
    [WebDisplayName("Obey Workflow")]  
    [Description("")]  
    public bool ObeyWorkflow { get; set; }
    
    0 讨论(0)
  • 2021-02-19 14:27

    i think its WebBrowsable(true) instead of Browsable(true)

    0 讨论(0)
提交回复
热议问题