MVC.Grid button with id parameter

Apr 29, 2016 at 1:43 PM
i have a mvc grid and i added a button in a column like this:

                                                            .RenderValueAs(o => @<input type="button" name="Extract" value="Extract" onclick="Extract()"/>);
but i would like to pass the id of the row in the Extract() function as parameter. how can i do that?
Apr 29, 2016 at 1:51 PM
Edited Apr 29, 2016 at 1:53 PM

If you know your model you can use razor sintax inside RenderValueAs
        .RenderValueAs(o => @<input type="button" name="Extract" value="Extract" onclick="Extract(@o.IdModel)" />);
"o" in RenderValueAs represent a "row" or a single instance of the item list you pass to the grid.

Hope it helps!
Marked as answer by Deatk on 4/29/2016 at 7:09 AM
Apr 29, 2016 at 2:09 PM
YES! thank you very much for the fast answer!!!!! :)