Latest telerik version incorrectly shows decimals in different locales

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
I'm from RU.
If you have not english locale and you have updated your telerik to the latest fixed version (for example from here) you can experience strange behavior.
To say it shorter if for example you  insert 2500 in textbox and save it to database, this decimal will be loaded fine from database as 2500, but it will be displayed by telerik as 2500000,0000 (1000 times greater).
I don't know what bug in telerik dll is causing it and how to fix it there, but you can fix this by changing a little in nopcommerce source.
You need to change locale.
For example in my case I did the following:

In Global.asax.cs:

//admin area
//always set culture to 'en-US'
//we set culture of admin area to 'en-US' because current implementation of Telerik grid
//doesn't work well in other cultures
//e.g., editing decimal value in russian culture
var culture = new CultureInfo("ru-RU");

As you see i'v changed culture here to ru-RU.

Also you need to change Nop.Admin Views/Shared/_AdminLayout.cshtml

    @(Html.Telerik().ScriptRegistrar()
            .jQuery(false)
            .jQueryValidation(false)
      .Globalization(true)
            )

Here you need to add .Globalization(true) line.
I don't know why it is exactly so, but it works only with these 2 changes implemented.
11 years ago
It works fine out of the box (without any source code changes).

This is a know issue (for several months). That's why culture was always set to 'en-US' for admin area. Telerik doesn't work properly in distinct cultures. So you cannot have other cultures in admin area ('en-US' only).
11 years ago
Yes but i have this problem if not changin source of nopcommerce. If I have en-US and globalization off (or not specified) then latest telerik version shows decimals 1000 times greater. I was able to fix this only by doing mentioned changes.
This is only with latest telerik version (the one before worked fine).
11 years ago
It works fine on my machine. What browser are you using?

Does anybody else with culture other than en-US (and comma as decimal separator) experience this issue?
11 years ago
go to
http://admin-demo.nopcommerce.com/Admin/ProductVariant/BulkEdit
Page source code
observe at the bottom of the page before
<script type="text/javascript" src="/Scripts/2012.1.214/telerik.grid.editing.min.js"></script>
tellerik dll creates when editing grid
<script type="text/javascript" src="/Scripts/2012.1.214/jquery.validate.min.js"></script>

this conflicts
<script type="text/javascript" src="/Scripts/2012.1.214/jquery.validate.min.js"></script>
at the head

quick solution
_AdminLayout.cshtml
Delete  your Html.AppendScriptParts....  validate  .

Add just before before </body>
<script type="text/javascript" src="/Scripts/2012.1.214/jquery.validate.min.js"></script>
No confict if they are both at the bottom  when editing.grid

of course change your
@(Html.Telerik().StyleSheetRegistrar() for gloabalisation and global.asax as front-end

when client side formating  prices  like bulkedit  usre  .Format("{0:n}")

columns.Bound(p => p.UnitPrice).Format("{0:n}")

that was the fix when i used nopcommerce last year i dont know if fixes late versions
11 years ago
@(Html.Telerik().StyleSheetRegistrar() has nothing to do with localization just copy-paste error


@(Html.Telerik().ScriptRegistrar()

              .Globalization(true)
            .jQuery(false)
            .jQueryValidation(false)
                    )

---
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
      <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
</body>

also   check telerik validate  and your  validate are same version just in case
11 years ago
gskoul3 wrote:
observe at the bottom of the page before
<script type="text/javascript" src="/Scripts/2012.1.214/telerik.grid.editing.min.js"></script>
tellerik dll creates when editing grid
<script type="text/javascript" src="/Scripts/2012.1.214/jquery.validate.min.js"></script>

this conflicts
<script type="text/javascript" src="/Scripts/2012.1.214/jquery.validate.min.js"></script>
at the head

Telerik DOES NOT add any references to jquery.validate.min.js out of the box because it's specified when defining ScriptRegistrar:
@(Html.Telerik().ScriptRegistrar()
    .jQueryValidation(false)
You can see it on our demo site. Furthermore, you're talking about version 2012.1.214 but Argar has referenced a newer version.


Argar wrote:
...

Also have a look at this forum topic
11 years ago
Telerik DOES NOT add any references to jquery.validate.min.js out of the box because it's specified when defining ScriptRegistrar:
@(Html.Telerik().ScriptRegistrar()
    .jQueryValidation(false)
----------------------------
Wrong it does out of the box   (if editing is enabled)
your dashboard page has no editing grid
http://admin-demo.nopcommerce.com/Admin/ProductVariant/BulkEdit has

from your demo site when editing grid is enabled: see the line above telerik.grid.editing.min.js
its out of the box


</script></td></tr></table></form></div></div><div class="throbber"><div class="curtain"></div><div class="curtain-content"><div><h1 class="throbber-header">Wait...</h1><p><img src="http:/admin-demo.nopcommerce.com/administration/content/images/throbber-synchronizing.gif" alt="" /></p></div></div></div></div></div><!--//-->
<link type="text/css" href="/Content/2012.1.214/telerik.common.min.css" rel="stylesheet"/><link type="text/css" href="/Content/2012.1.214/telerik.vista.min.css" rel="stylesheet"/><link type="text/css" href="/Content/2012.1.214/telerik.rtl.min.css" rel="stylesheet"/><script type="text/javascript" src="/Scripts/2012.1.214/telerik.common.min.js"></script> <script type="text/javascript" src="/Scripts/2012.1.214/telerik.textbox.min.js"></script> <script type="text/javascript" src="/Scripts/2012.1.214/telerik.grid.min.js"></script> <script type="text/javascript" src="/Scripts/2012.1.214/jquery.validate.min.js"></script> <script type="text/javascript" src="/Scripts/2012.1.214/telerik.grid.editing.min.js"></script> <script type="text/javascript" src="/Scripts/2012.1.214/telerik.menu.min.js"></script> <script type="text/javascript">//<![CDATA[


see also
http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-required-javascript-files.html

jquery-1.7.1.min.js
jquery.validate.min.js (if editing is enabled)
telerik.common.min.js
telerik.calendar.min.js (if there are columns bound to DateTime or DateTime? property)
telerik.datepicker.min.js (if there are columns bound to DateTime or DateTime? property)
telerik.textbox.min.js (if there are columns bound to a numeric property and filtering is enabled)
telerik.grid.min.js
telerik.draganddrop.min.js (if grouping, popup editing, resizing or reordering is enabled)
telerik.grid.grouping.min.js (if grouping is enabled)
telerik.grid.filtering.min.js (if filtering is enabled)
telerik.grid.resizing.min.js (if column resizing is enabled)
telerik.grid.reordering.min.js (if column reordering is enabled)
telerik.grid.editing.min.js (if editing is enabled)
telerik.window.min.js (if popup editing is enabled)

---------------------------
http://www.telerik.com/community/forums/aspnet-mvc/general/validation-in-the-asp-net-mvc-grid.aspx
Hi Aleks,
The validation is always enabled. The grid needs jquery.validate.js and jquery.js to be included in order to work properly. The complete list of required JavaScript files is available here.
Regards,
Atanas Korchev
the Telerik team
--------------
The fix of course was for
                        //always set culture to 'en-US'
                        //we set culture of admin area to 'en-US' because current implementation of Telerik grid
                        //doesn't work well in other cultures
                        //e.g., editing decimal value in russian culture
not argar post but it might relate
11 years ago
Hmm. You're absolutely right. I'll have a look at this issue. Thanks for pointing me out!
11 years ago
I've just tested it one more time with latest Telerik version (2012.2) and it does not add jquery.validate.min.js even on the bulk edit page. But version 2012.1 (previous one) really added this js file.

I've also replaced \Scripts\2012.2.607\jquery.validate.min.js file (version 1.8.0.0 added by Telerik) with the latest jquery.validate.min.js file (version 1.9.0.0) which is used by nopCommerce (Html.AppendScriptParts in _AdminLayout.cshtml). Changeset 12348f2e706f

BWT, although the demo site references two distinct versions of jquery.validate.min.js file (1.8.0.0 by Telerik and 1.9.0.0 by nopCommerce), it works fine and does not cause validation issues related to decimal in distinct locales
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.