从本地.resx文件获取值

Rai*_*ika 1 asp.net

如何从asp.net中的本地.resx文件中获取价值?

vol*_*pav 5

从代码隐藏:

CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");

// Gets the value of associated with key "MyKey" from the local resource file for a given culture ("~/MyPage.aspx.en.resx") or from the default one ("~/MyPage.aspx.resx")
object keyValue = HttpContext.GetLocalResourceObject("~/MyPage.aspx", "MyKey", culture);
Run Code Online (Sandbox Code Playgroud)

如果需要在页面/用户控件上直接填充值,则可以使用这些技术之一从资源文件中获取值.