0

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?

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

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.