I have following html defined in my cshtml file
<span>
@Html.Raw(String.Format(Resources.Test,
"<a href=\"#\" role=\"button\" style=\"color: #458ccc; \" data-container=\"body\" data-trigger=\"hover\" data-placement=\"auto right\" data-bind=\"bootstrapPopover: { title: 'title1', content: 'something', template: '<div class="popover" style="padding:0px;" role="tooltip"><div class="arrow"></div><h3 class="popover-title" style="background-color:#458ccc; color:#FFF; "></h3><div class="popover-content"></div></div>' }\">name1<span class=\"fa fa-question-circle-o\" style=\"font-size:1em;\"></span></a>",
"<a href=\"#\" role=\"button\" style=\"color: #458ccc; \" data-container=\"body\" data-trigger=\"hover\" data-placement=\"auto right\" data-bind=\"bootstrapPopover: { title: 'title2', content: 'anything', template: '<div class="popover" style="padding:0px;" role="tooltip"><div class="arrow"></div><h3 class="popover-title" style="background-color:#458ccc; color:#FFF; "></h3><div class="popover-content"></div></div>' }\">name2<span class=\"fa fa-question-circle-o\" style=\"font-size:1em;\"></span></a>"))
</span>
i want to replace hardcode text "title1" and "title2" from resource file but i am really stuck on how to use Resources.Title1 and Resources.Title2. I get so many syntax errors. Any help?
There are no title1 or title2 references, I'm also not entirely sure why you'd put so much html in the format, wouldn't <a href="#">@Html.Raw(Resources.title1)</a>
work? If there's really some formatting required due to a parameter in Resources.Test
: <a href="#">@Html.Raw(string.Format(Resources.Test, Resources.title1))</a>
?
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.