简体   繁体   中英

How to use Resource File for html parameters?

In my project we are using Resource files and i am calling the resource file by the following syntax:

@HttpContext.GetGlobalResourceObject(CustomersResource, "t_GoBackCustomer")

where CustomersResource is the Resource file name and t_GoBackCustomer is the key name. The value of the key will be like "Go Back to Previous Page". The whole value is rendering for labels and other places without any problem.

But when i use <a title=@HttpContext.GetGlobalResourceObject(CustomersResource, "t_GoBackCustomer")> only the first word is coming as title. ie while pressing F12 I can see as

            `<a  title="Go" Back to Previous Page></a>'

Only "Go" is coming as title. The words after space is not considered as title. The same is the case for Placeholder. Can anyone say what is the mistake i am doing here?

I have found solution to my problem. I have to use the following syntax to get words with spaces.

<a title='@HttpContext.GetGlobalResourceObject(CustomersResource, "t_GoBackCustomer")'>

The single quotes did the magic. For labels and controls we no need to use single quotes. But while using for html parameters like Title and PlaceHolder we must need to use Quotes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM