I have written custom attribute for DisplayName as follows.
namespace CRM.Model
{
public class LocalizedDisplayNameAttribute : DisplayNameAttribute
{
private readonly string resourcekey;
public LocalizedDisplayNameAttribute(string resourceId)
: base(GetMessageFromResource(resourceId))
{
}
public static string GetMessageFromResource(string resourceId)
{
// My Localization logic
return LocalizationResourceProvider.Current.GetString(resourceId);
}
}
}
When model is loaded/initiated for the first time the above custom attribute class is called successfully.
But if, I will post back the page then, it doesn't get called.
For example when I change my language from English to French. it still displays the English content.
Why it is so ? How can I solve this issue ? Can we load the Model data explicitly