Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Update:

private string _catalogIconImageUrl = "http://hostname/images/favicon.ico";

 [WebBrowsableAttribute(false),
    Category("HIDDEN"),
    Personalizable(PersonalizationScope.User),
    WebDisplayName("Catalog Icon Image url"),
    WebDescription("Something")]
    public string CatalogIconImageUrl
    {
        get
        {
            return _catalogIconImageUrl;
        }
        set
        {
            _catalogIconImageUrl = value;
        }
    }

with the above code, it does not show the image and also when i click on edit the webpart i still able to see the catalogIconImageUrl prop in edit mode

Update end

I've declared the property CatalogIconImageURL in the .Webpart file as follows:-

</property>    
<property name="CatalogIconImageUrl" type="string">images/company/companylogo.jpg</property>    //sample path...
</properties>

if I click on the Advanced Web Part Gallery as shown below in the screen shot, i able to see that property in editable so my question is, is there a way i can hide this property when user edit the web part? "Catalog Icon Image URL"

enter image description here

share|improve this question

2 Answers 2

So is this a custom webpart that you coded? If so, you can change the property attributes in the code (not .webpart file):

   [WebBrowsableAttribute(false),
    Category("HIDDEN"),
    Personalizable(PersonalizationScope.User),
    WebDisplayName("Catalog Icon Image url"),
    WebDescription("Something")]
    public string CatalogIconImageUrl
    {
        get
        {
            return _catalogIconImageUrl;
        }
        set
        {
            _catalogIconImageUrl = value;
        }
    }

The one that will hide it when they click edit is the WebBrowseableAttribute(false), the other code is there just to help you with context.

share|improve this answer
    
still showing when i edit the webpart –  Abu Hamzah Aug 31 '11 at 13:56
    
Can you post a portion of your C# code? Also, if you change the category, display name, or description, does it change it in edit mode as well? –  Steve Lineberry Aug 31 '11 at 13:58
    
i have updated my question... –  Abu Hamzah Aug 31 '11 at 14:15

The attribute should be WebBrowsable(false) not WebBrowsableAttribute(false) http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.webbrowsableattribute(v=VS.90).aspx

share|improve this answer
    
Not correct. [WebBrowsable(false)] and [WebBrowsableAttribute(false)] are both legal and equivalent. –  kbrimington Feb 28 '12 at 21:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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