Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send additional data to Telerik MVC grid

I am using AJAX bound Telerik MVC grid. I am sending data for the grid using a code like the following:

return View(new GridModel(...));

I want to be able to send additional data to client in the same action method. For example I need to send a single int value Total, which is to be shown above the grid (this value must be fetched from db, it cannot be evaluated client-side).

Please share any ideas.

like image 965
Narek Malkhasyan Avatar asked Nov 14 '22 09:11

Narek Malkhasyan


1 Answers

To achieve your desired result, you could add a client footer template bound to the property passed down from your model as follows:

columns.Bound(o => o.UnitPrice)
       .ClientFooterTemplate("<#= Total #>");

There is also a good example detailing the use of server aggregates on the Telerik site if you wanted to work these out using aggregate functions in the future.

like image 113
Nick Avatar answered Nov 27 '22 18:11

Nick