开发者

Working with resources

开发者 https://www.devze.com 2023-01-28 05:29 出处:网络
there! I\'m working with asp.net 3.5 web-site. And I have such problem: I have 3 aspx pages, that contain asp:Label control with name \"LabelContent\" and foreach page I have two re开发者_如何学编程sx

there! I'm working with asp.net 3.5 web-site. And I have such problem: I have 3 aspx pages, that contain asp:Label control with name "LabelContent" and foreach page I have two re开发者_如何学编程sx files, that contain LabelContentResource.Text and LabelContent binds LabelContentResource to , for 2 cultures. Also I have content editing page. On this page admin choses page for edit and in WYSIWG editor I need to load appropriate resorce. Like so:

string pageForLoadName = "links.aspx.de-AT.resx";
string key ="LabelContent.Text";
string resValue= LoadREsource(pageForLoadName ,key );

How can I write LoadREsource fnction? Thanks!


Something along the lines of

public string LoadResource(string pageForLoadName,string key)
{
    return (String)HttpContext.GetGlobalResourceObject(pageForLoadName, key);
}

Also, don't think you need pageForLoadName = "links.aspx.de-AT.resx";

just pageForLoadName = "links.aspx.de-AT";

0

精彩评论

暂无评论...
验证码 换一张
取 消