[英]Rateit plugin doesn't preset double value from View Model
I don't know whats going on. 我不知道怎么回事。 I'm using RateIt Plugin for my web Application. 我正在为我的Web应用程序使用RateIt插件 。 The problem is that data-rateit-vaue
doesn't work properly. 问题是data-rateit-vaue
无法正常工作。 Specify the plugin doesn't preset value if my value contains decimal places. 如果我的值包含小数位,请指定插件未预设的值。 If no everything ok. 如果没有,一切正常。 Also it can set the value with decimal places from the script $('#' + photoId).rateit('value', result.averageRating);
它还可以从脚本$('#' + photoId).rateit('value', result.averageRating);
设置带有小数位$('#' + photoId).rateit('value', result.averageRating);
and it work's fine. 很好 What's wrong with my code in View? View中的代码有什么问题?
Average Raiting <span class="rateit" id="@Model.PhotoId" data-rateit-readonly="true" data-rateit-ispreset="true" data-rateit-value="@Model.AverageRating"></span>
PS If I change my code in view like data-rateit-value="1.12324 ... 324"
everything works correctly. PS:如果我在data-rateit-value="1.12324 ... 324"
视图中更改代码,例如data-rateit-value="1.12324 ... 324"
一切正常。
I've solved my problem. 我已经解决了我的问题。 I just need to specify the Invariant culture to get a period as decimal separator: data-rateit-value="@Model.AverageRating.ToString("0.00000", System.Globalization.CultureInfo.InvariantCulture)"
我只需要指定不变文化就可以将句点作为小数点分隔符: data-rateit-value="@Model.AverageRating.ToString("0.00000", System.Globalization.CultureInfo.InvariantCulture)"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.