views:

52

answers:

1

I want to localize my resources (form labels, validation messages etc) using DisplayAttribute. I have my resources in the database, but looks like DisplayAttribute uses the resx files, and the class is sealed itself so I cannot derive a subclass and override the require methods/properties.

Is there any way of handling the resourcemanager used by DisplayAttribute, to get the resources from the database instead of the resx files.

And no, I can not use the resx files.

A: 

You will need to create your own ResourceProvider to get the messages from the database, and then set the <globalization> tag in Web.Config to point to your custom ResourceProvider. .Net will then use this instead of resx files.

Detailed explanation: http://msdn.microsoft.com/en-us/library/aa905797.aspx

Clicktricity