开发者

Unable to assign Resource Key to asp.net Label

开发者 https://www.devze.com 2023-01-31 02:45 出处:网络
Am new to development , as startup, am learning from different 开发者_如何学JAVAvideos and tutorials. Right now am facing a strange problem

Am new to development , as startup, am learning from different 开发者_如何学JAVAvideos and tutorials. Right now am facing a strange problem

i have a asp.net label

<asp:Label ID="Label2" runat="server" Text="<%$ Resources:Label1TextKey %>" />

and i have defined his key in

App_GlobalResources >>  Resource.resx >> Label1TextKey

but when i build , it is giving

Error   1   The resource object with key 'Label1TextKey' was not found.      C:\Documents and Settings\Maya\My Documents\Visual Studio 2008\WebSites\WebSite1\Default.aspx  14

Can and body help me out?


It should be:

Text="<%$ Resources:Resource,Label1TextKey %>"

The syntax is like this:

<%$ Resources:ClassName,KeyName,DefaultValue %>

where ClassName is the name of the resource file and KeyName is the key inside this file.


well you are using wrongly

correct declaration is

<%$ Resources:[filename prefix,]resource-key %>

in your case File name is Resource and resource-key is Label1TextKey

Source http://quickstarts.asp.net/QuickStartv20/aspnet/doc/localization/localization.aspx

0

精彩评论

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

关注公众号