开发者

C# problem with dot in resource file

I'm having a little problem with a dot (.) in a resource file. In my global.resx file I have the value:

Key: DSNLBuiltNo
Value: DS.NLM + Built no

When I display this in my Razor file with a @Html.Label(Global.DSNLBuiltNo) I only see NLM + Built no in my page (and the underlying HTML.) Anyo开发者_如何学运维ne knows what is going on here?


It's because of the way the Label method works. By only including one string you're basically saying that the label is for that particular id. Since you didn't provide the actual label text it assumes that you're referencing an actual property somewhere and only uses the property name itself and not it's fully qualified namespace. To get the output you're expecting (if a label is the proper output) then you want to use:

@Html.Label(Global.DSNLBuiltNo, Global.DSNLBuiltNo)

or if you don't really need a label since it's not referencing an actual id anywhere

@Global.DSNLBuiltNo
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜