0

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

1

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

  • Not correct. [WebBrowsable(false)] and [WebBrowsableAttribute(false)] are both legal and equivalent. – kbrimington Feb 28 '12 at 21:19
0

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.

  • still showing when i edit the webpart – Nick Kahn 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... – Nick Kahn Aug 31 '11 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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