How to get selected Row

May 17, 2014 at 4:20 PM
Hello, first off... this is an awesome object!!!!

I have some buttons after this grid. How do I get the selected row from this grid and pass it to the button when it's clicked? I need to get the value of columnID from this grid.

I'm using ASP.NET MVC4. Thanks.
Coordinator
May 31, 2014 at 3:05 PM
How to get selected value please see - https://gridmvc.codeplex.com/wikipage?title=Client%20side%20%28javascript%29&referringTitle=Documentation


You can setup the hidden field with selected value, and then pass it to the server
<form action="<YOUR CONTROLER ACTION URL>">
    <input type="hidden" id="hiddenfield" name="SelectedId" />
   <button type="submit">Send</button>

</form>
<script>
    $(function () {
        pageGrids.yourGrid.onRowSelect(function (e) {
            $('#hiddenfield').val(e.Id);
        });
    });
</script>