ClientTemplate - Math Round \ String Format with no decimals

3 posts, 0 answers
  1. Yaniv
    Yaniv avatar
    6 posts
    Member since:
    Sep 2013

    Posted 06 Mar 2014 Link to this post

    Hi,
    I can get any data with the client template and it works fine, but i cannot find a way to round a 'Double' value as math round or in string.Format("C0")
    in the client template. I want to round the dataItem.QuoteSumDollars which is a 'Double' with no decimal digits.
    Here is my HtmlChart Series:

                               <Series>
                                <telerik:LineSeries Name="Quote" DataFieldY="QuoteSumDollars">
                                    <LabelsAppearance>
                                        <ClientTemplate>
                                             #=dataItem.QuoteSumDollars#
                                        </ClientTemplate>
                                    </LabelsAppearance>
                                    <TooltipsAppearance>
                                        <ClientTemplate>
                                            Quote #=dataItem.QuoteID#
                                        </ClientTemplate>
                                    </TooltipsAppearance>
                                </telerik:LineSeries>
                            </Series>

    Many thanks.
  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1492 posts

    Posted 10 Mar 2014 Link to this post

    Hello Yaniv,

    You can use the kendo.format() method in order to format values in templates. More information on the matter is available in Formatting Numbers help article, in the section called Formatting Labels and Tooltips by using their Client Templates.

    Regards,
    Danail Vasilev
    Telerik

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Yaniv
    Yaniv avatar
    6 posts
    Member since:
    Sep 2013

    Posted 18 Mar 2014 in reply to Danail Vasilev Link to this post

    Thanks!
    It worked by doing:

     #=dataItem.QuoteSumDollars.format("N0")#
Back to Top