Note that there are some explanatory texts on larger screens.

plurals
  1. POWebGrid Ajax.. how to make it work with MVC 4 W/Razor
    text
    copied!<p>I started working on WebGrid with MVC 4 and I able to display the paginating/sorting and its work as expected.... if i try to make it with with ajax then its doing the full post.</p> <p>View: - Partial View: (_hostajax.cshtml)</p> <pre><code>@model IEnumerable&lt;issoa_ef.host&gt; @{ ViewBag.Title = "Index"; } &lt;h2&gt;Index&lt;/h2&gt; &lt;p&gt; @Html.ActionLink("Create New", "Create") &lt;/p&gt; @{ var grid = new WebGrid( Model, rowsPerPage: 2, defaultSort: "HostFirstName", ajaxUpdateContainerId: "ajaxgrid"); } &lt;div id="ajaxgrid"&gt; @grid.GetHtml( tableStyle: "gridTable", headerStyle: "gridHead", footerStyle: "gridFooter", rowStyle: "gridRow", alternatingRowStyle: "gridAltRow", columns: grid.Columns ( grid.Column("HostFirstName", header: "First Name", format: @&lt;text&gt;@Html.ActionLink((string)item.HostFirstName, "Details", "Host", new { id = item.HostId }, null)&lt;/text&gt;), grid.Column("HostMiddleName", header: "Middle Name"), grid.Column("HostLastName", header: "Last Name"), grid.Column("HostEmailAddress", header: "eMail Address") ) ) &lt;/div&gt; </code></pre> <p>Controller:</p> <pre><code> public ActionResult Index() { var model = db.host.ToList(); if (Request.IsAjaxRequest()) return PartialView("_hostajax", model); else return View(model); } </code></pre> <p>Index page:</p> <pre><code>&lt;h2&gt;@ViewBag.Message&lt;/h2&gt; &lt;p&gt; @Html.ActionLink("Request Deployment", "CreateDeployment") &lt;/p&gt; @Html.Partial("_hostajax", Model) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload