Reputation: 14123
In my MVC application, I have put a string in my CommonResourceFile
a string
* indicates mandatory fields.
I noticed a strange thing here. This string was not visible on the view. And on removing .
from the end, it became visible. Why so?
Update
This is the related view code :
<span>*</span> <%:Html.Label(CommonResource.MandatoryFields)%></div>
CommonResource.MandatoryFields is indicates mandatory fields.
Upvotes: 0
Views: 148
Reputation: 139758
Your problem has nothing to do with resource files.
You are misusing the Html.Label helper because it's argument is a property expression not the text that you want to display.
That's why it confuses when you have a dot .
in your resource because it tries to interpret the input string as a property expression (so it's splitting on dots etc.).
So don't use the Html.Label
to display arbitrary texts instead of write out the label tag by hand (or create an own helper)
<label><%: CommonResource.MandatoryFields ></label>
Upvotes: 2