Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > General Discussions > $.telerik.formatString documentation

Not answered $.telerik.formatString documentation

Feed from this thread
  • Hiram avatar

    Posted on Apr 4, 2012 (permalink)

    I'm Using ASP.Net MVC

    1- How do I find $.telerik.formatString documentation. I see samples when using grids with AJAX bindings, but cannot find the actual documentation?
    2- I need to format data depending on client browser culture while respecting the value’s attributes. For instance: I want to display currency fields with the proper numeric representation of the client culture, while keeping the currency code/symbol of the value (if the currency is USD it should show as $ no matter how the client view numbers $1,234.56 or $1234,56, since changing the currency code without currency conversion is not acceptable).

    I have the following logic working for server side formatting, but I need similar logic for client side:

     

    public static string GetCurrencyFormated(decimal? val)

    {

      if (val.HasValue)

        return string.Format("$ {0}", val.Value.ToString("f"));

      return string.Empty;

    }

    Thank you

    Reply

  • Petur Subev Petur Subev admin's avatar

    Posted on Apr 9, 2012 (permalink)

    Hello Hiram,

    Currently we don't have any documentation for the formatString utility method method but it will be added in the future.
    Basically the method covers most of the functionality provided by the C# string.Format method - all the stuff with placeholders
    e.g.
    $.telerik.formatString("test {0:C3}",2323.3434) -> "test $2,323.343"

    Regarding to the globalization question - you should enable globalization (in the ScriptRegistrar config).


    All the best,
    Petur Subev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.

    Reply

  • Posted on Jun 22, 2012 (permalink)

    Just forget, ist working. it was just a cache error.

    i have set the globalization attribute to true like this:

    @(Html.Telerik().ScriptRegistrar().DefaultGroup(group =>
           group.Add("~/Scripts/slimScroll.min.js")
           .Add("~/Scripts/jquery-ui-1.8.11.min.js")
           .Add("~/Scripts/jstween-1.1.min.js")
           .Add("~/Scripts/jquery.ballon.js")
           .Add("~/Scripts/Common.js")
           .Add("~/Scripts/jquery.ae.image.resize.min.js")
           .Add("~/Scripts/json2.js")
           .Add("~/Scripts/jquery.mousewheel.js")
           .Add("~/Scripts/antiscroll.js")
           .Add("~/Scripts/f5tooltip.js")
           .Add("~/Scripts/f5login.js")
           .Add("~/Scripts/jquery-ui-1.7.2.custom.min.js")
           .Add("~/Scripts/jquery.flip.min.js")
           .Combined(false).Compress(true)).Globalization(true))

    but when i do $.telerik.formatString("{0:C}",value) the returned value  always have $ as currency symbol

    Is the string format function culture aware or not?

    and of course i'm setting the cultureui and culture to pt-PT so i think i should see a € symbol, for the time being :)

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > General Discussions > $.telerik.formatString documentation