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

I have a web part with a WebDescription attribute that contains a description of the web part. E.g.

    [
    Category("Configuration"),
    Personalizable(PersonalizationScope.Shared),
    WebBrowsable,
    WebDescription("Setting this option will make sorting, paging, filtering and refresh operations asynchronous"),
    WebDisplayName("Enable Asychronous Update")
    ]
    public bool EnableAsyncUpdate
    {
        get
        {
            return _enableAsyncUpdate;
        }
        set
        {
            _enableAsyncUpdate = value;
        }
    }

I want to dynamically change the WebDescription value by pulling a string from a resource file. E.g.

WebDescription(resourceManager.GetString("WebDescription"),

but the WebDescription attribute only accepts constants. Is there another way to dynamically populate the WebDescription attribute of a WebPart?

share|improve this question

1 Answer 1

I've faced a similar problem before. Can't remember if this solution actually worked, but you could try creating a class that inherits from WebDescriptionAttribute and use the constructor to pass in your resource key instead of the resource string itself.

Then override the Description property to read the resource from the resource manager.

Something like this

http://forums.asp.net/t/937207.aspx

share|improve this answer

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.