I have a input tag like:
<input src="..." title="<%= SomeResource.Label1 %>" />
It is not rending the text, it is rendering the actual value in the title attribute:
<%= SomeResource.SoeLabelInMyResourceFile%>
I tried single quotes and no change, what am i doing wrong?
It is suppose to render the title attribute as:
title="some text value stored in the resource file"
So the issue is the server tags are not being rendered, rather it is thinking that is plain text I want to display for the value of the title attribute.
UPDATE
The text renders just fine if I do this:
<td>
<%= SomeResource.Label1 %>
<input src="..." title="" />
</td>
But if I put the tags inside the title attribute, I get the error.
UPDATE
1 Create service folder App_GlobalResources (Project -> Add -> ASP.NET Folder)
2 Move resx-files to this folder
3 Get access to data:
In addition to programmatic access, ASP.NET 2.0 also introduces declarative syntax you can use to bind a named string to a property of a page or control. The syntax involves using the dollar sign ($) followed by the Resources namespace, the name of the resource file and the name of the string [see Resources and Localization in ASP.NET 2.0]
<asp:Literal runat="server" Text="<%$ Resources:Resource1, String1 %>" />
<input runat="server" type="text" value="<%$ Resources:Resource1, String1 %>" />
It works fine!
Try it:
<input src="..." title="<%$ Resources:SomeResource, Label1 %>" />
or
<input runat="server" src="..." title="<%$ Resources:SomeResource, Label1 %>" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With