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
精彩评论