Can we use Resource Expressions in javascript and other parts except Literal?

Posted by balexandre on Stack Overflow See other posts from Stack Overflow or by balexandre
Published on 2010-06-10T12:31:45Z Indexed on 2010/06/10 12:32 UTC
Read the original article Hit count: 179

The Literal control works all the time

<asp:Literal ID="Literal7" runat="server" 
    Text="<%$ Resources:ErrorMessages, errorCompanyNotFound %>" />

But if I want to use this as a parameter in an image, like

<img src="blahblah" alt="" 
    title"<%$ Resources:ErrorMessages, errorCompanyNotFound %>" />

It gives the annoying error

Literal expressions like '' are not allowed. Use instead.

Same happens if I try to access it through Javascript

var noHit = '<%$ Resources:ErrorMessages, errorCompanyNotFound %>';

Does anyone had any idea how can I fetch the Global Resource value under this circumstances?

© Stack Overflow or respective owner

Related posts about c#

Related posts about localization