We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Does grid rendering time vary with size of underlying collection?

When rendering my output page for a record set of 129,000 records, the grid control seems to take nearly 10 seconds to render. I know it is entirely in the rendering because the data is cached between requests. Is this normal? If I filter my record set down to only a thousand rows or so, the render time is cut to under a second.

***
Note - I'm not showing all 129k rows, I'm only only asking the grid to show the first page of rows, completely unsorted.
***

I create a grid as such:

return new GridPropertiesModel
{
DataSource = dataSource,
PagingSortingMapper = pagingSortingMapperUrl,
Caption = caption,
AllowSorting = true,
AllowPaging = true,
AllowMultiSorting = true,
PageCount = 10,
PageSize = 16,
HeaderText =
{
"ColA",
"ColB",
"ColC",
"ColD",
"ColE",
"ColF",
"ColG",
"ColH",
"ColI",
"ColJ",
"ColK"
},
PrimaryKeyColumns = {"ColA"},
ShowCaption = false,
};

and I render it on the page like this:

<%=Html.Grid(
"ModelInformation_Grid", "GridModel", column =>
{
column.Add(p => p.ColA).HeaderText("ColA");
column.Add(p => p.ColB).HeaderText("ColB");
column.Add(p => p.ColC).HeaderText("ColC");
column.Add(p => p.ColD).HeaderText("ColD");
column.Add(p => p.ColE).HeaderText("ColE");
column.Add(p => p.ColF).HeaderText("ColF");
column.Add(p => p.ColG).HeaderText("ColG");
column.Add(p => p.ColH).HeaderText("ColH");
column.Add(p => p.ColI).HeaderText("ColI");
column.Add(p => p.ColJ).HeaderText("ColJ");
column.Add(p => p.ColK).HeaderText("ColK");
}) %>

Any idea why this is taking so long? I've profiled it, and it is definitely taking nearly all the time inside your code.

-- bab

1 Reply

BM Balaji M Syncfusion Team September 14, 2009 07:55 PM UTC

Hi Brian,

Thank you for your interest in syncfusion products.

we would suggest you to use OnDamand feature in MVC Grid to get better performance.


In order to enable OnDemand use the following two properties,

1. EnableOnDemand - Get or Set OnDemand paging/sorting.
2. IsGrouped property in PagingParams - Indicates the grouping state in Grid.


Please refer the below code snippet to achieve onDamand

public ActionResult Index()
{
GridPropertiesModel model = new GridPropertiesModel
{
DataSource = new context().Voters.Skip(0).Take(29000).ToList(),
AutoFormat = Syncfusion.Mvc.Shared.Skins.Office2007Silver,
EnableOnDemand=true,
TotalRecordsCount = 29000,
AllowSorting=true,
AllowPaging=true,
PageCount=6,
PageSize=15,
PagingSortingMapper="PagingAction",
Caption = "Voter Information",
PrimaryKeyColumns = { "VoterId" }
};

ViewData["GridModel"] = model;
return View();
}

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult PagingAction(PagingParams args)
{
IEnumerable data = new context().Voters.Skip(args.StartIndex).Take(args.PageSize).AsQueryable();
ActionResult result = data.GridActions();
return result;
}


Please refer the sample from the below link.

http://files.syncfusion.com/support/grid_mvc/Incidents/60054/Mvc_SampleGrid.zip

Please follow up the Direct-Trac incident#60054for more further.

Please let me know if you have any concerns

Regards,
M. Balaji

Loader.
Live Chat Icon For mobile
Up arrow icon