Set grid footer format only if rows exist

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    2 posts
    Member since:
    Nov 2012

    Posted 19 Nov 2014 Link to this post

    Hi,

    We've got a simple server bound grid which show aggregates in the footer and sets the Footer Template format to be currency - ...

    .FooterTemplate(f => f.Sum.Format("{0:c}")).

    Good if there are rows, but this throws an error if there are zero rows returned in the model.

    How can we apply the correct formatting only if there are rows returned?

    (Found this thread but the last response says the answer was through a support call - http://www.telerik.com/forums/conditionals-embedded-in-client-templates )

    Many Thanks,

    Dan.
  2. Daniel
    Daniel avatar
    2 posts
    Member since:
    Nov 2012

    Posted 19 Nov 2014 in reply to Daniel Link to this post

    Found it ...

    .FooterTemplate(@<text>@String.Format("{0:C}", item.Sum) </text>)

    Just use that instead.

  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top