This is a migrated thread and some comments may be shown as answers.

Set grid footer format only if rows exist

1 Answer 38 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 19 Nov 2014, 04:21 PM
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.

1 Answer, 1 is accepted

Sort by
0
Daniel
Top achievements
Rank 1
answered on 19 Nov 2014, 05:33 PM
Found it ...

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

Just use that instead.

Tags
General Discussions
Asked by
Daniel
Top achievements
Rank 1
Answers by
Daniel
Top achievements
Rank 1
Share this question
or