Localize DisplayNameAttributes in ActionFilter?
Posted
by boris callens
on Stack Overflow
See other posts from Stack Overflow
or by boris callens
Published on 2010-05-28T13:00:31Z
Indexed on
2010/05/29
16:42 UTC
Read the original article
Hit count: 498
Is it possible to access the DisplayNameAttributes that are used on my ViewData.Model so I can Localize them before sending them to the view? Something like this:
Public Void OnActionExecuted(ActionExecutedContext: filterContext) {
foreach (DisplayNameAttribute attr in filterContext...) {
attr.TheValue = AppMessages.GetLocazation(attr.TheValue);
}
}
What I'm missing is how to access the attributes. Is this possible at all?
P.S: We're using vb.net at my job and it's infiltrating my brain. So apologies if my C# is a tad off.
© Stack Overflow or respective owner