You need to define ajaxUpdateCallback function, for example:
var grid = new WebGrid(source: Model, ajaxUpdateCallback: "GridUpdate", ajaxUpdateContainerId: "grid" rowsPerPage: 50);
make sure your .GetHtml method has:
@grid.GetHtml( htmlAttributes: new { id = "grid" },
and add below to your main view
<script type="text/javascript"> function GridUpdate(data) { $('#grid').html(data); } </script>
Take 5 minutes to look at your WebGrid code, this will help you a lot and save time in the future. what it is is an HTML table with jQuery code. Look at the page links and headers (for sorting) all of which are just $ .load () invocations with the Url and Callback options. So, itβs important to figure out the correct div id and callback function :)
source share