I am using the latest RC2 version of MVC3.
I have a webgrid and it is giving me horrible problems, specifically with the paging and sorting. I have been told that the paging should be more efficient now, and not pull back the whole table but only rows needed for the page you are viewing. This is not working as i hoped (very slow), and so have taken it to the simplest form and booted up the profiler.
I have this ActionResult:
public ActionResult TestGrid()
{
return View(ents.Decisions);
}
And this view:
@model IEnumerable<DecisionPanel.Web.Models.DataModel.Decision>
@{
ViewBag.Title = "TestGrid";
var usersGrid = new WebGrid(source: Model, rowsPerPage: 50);
}
<h2>TestGrid</h2>
@usersGrid.GetHtml(
tableStyle: "grid",
headerStyle: "header",
alternatingRowStyle: "alt",
rowStyle: "row",
columns: usersGrid.Columns(
usersGrid.Column("UserID", "User Id"),
usersGrid.Column("HasAgreed", "Has Agreed?"),
usersGrid.Column("Comment"),
usersGrid.Column("DateResponded", "Date of Response", format: @<text>@item.DateResponded.ToString("dd MMM yyy (HH:mm.ss)")</text>)
)
)
Hitting the page is causing this to run on the profiler - 11 times:
SELECT
[Extent1].[ID] AS [ID],
[Extent1].[UserID] AS [UserID],
[Extent1].[HasAgreed] AS [HasAgreed],
[Extent1].[Comment] AS [Comment],
[Extent1].[DateResponded] AS [DateResponded]
FROM [dbo].[DecisionResults] AS [Extent1]
I am having some other problems but if i can t even get this working i am considering abandoning the webgrid.
I know it s early days with it being out under a week, but has anyone else had any joy using the paging?