i create a new class which inherite the IResourceProvider,and register it in web.config
<globalization resourceProviderFactoryType="xx.xxx.xxxx" uiCulture="auto" enableClientBasedCulture="true"/>
this new class just implement
public GetObject(string resourceKey, CultureInfo culture)
{
....
}
which will get globalization text from my own db.
question is how i can use it in validation Attribute, such as below syntax:
[StringLength(5, ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "StringLength")]
public string StringLength { get; set; }
and also how use it in view directly? in classic web form, i can just use
<asp:Litera开发者_运维百科l ID="test" runat="server" Text="<%$ resources:Text,123 %>"></asp:Literal>
thanks
and also how use it in view directly?
You should be able to reference your resource class in the view with something like this:
<%: xx.xxx.xxxx.IdOfString >
If you don't want to fully qualify the class/namespace on each view you can declare the xx.xxx.xxxx namespace on your web.config under the pages/namespaces section and then you could use:
<%: xxxx.IdOfString %>
精彩评论