This question is locked. New answers and comments are not allowed.
We are using the Telerik Grid which works fine when our database has 30,000 records or so.
When the load increases to 700K records, it returns a timeout. We followed some other threads
in this forum and ensure that we return a IQueryable to the Grid which means that it should return
only the 20 records to the Grid no matter what the size of the db is. But in spite of that, the Grid
breaks when the record count is 700 K. We are using LINQ. I have attached portion of our code
Please suggest a fix when large amounts of data is involved
[GridAction]
public ActionResult _CheckBoxesSongGrid(int workflowStatus)
{
var adminQueueByStatus = _repository.AdminQueueByStatus(workflowStatus);
return View(new GridModel(adminQueueByStatus));
}
DB call........
/* ----------------------------------------------------------------------------
* list of songs in an admin queue by status
* ----------------------------------------------------------------------------
*/
public IQueryable<vwLstUserSongAssignment> AdminQueueByStatus(int statusID)
{
return dbMusicLicensor.vwLstUserSongAssignments.Where(p => p.workflow_status_id == statusID);
}
View.......
<div id="rhAdminInProgress">
<%
int[] checkedRecordsInProgress = (int[])ViewData["checkedRecordsInProgress"];
Html.Telerik().Grid<vwLstUserSongAssignment>()
.Name("InProgressGrid")
.Columns(columns =>
{
columns.Bound(o => o.user_track_assignment_id)
.ClientTemplate("<input type='checkbox' name='checkedRecordsInProgress' value='<#= user_track_assignment_id #>' />")
.Title(strings.ID_25)
.Width(50)
.HtmlAttributes(new { style = "text-align:center" });
columns.Bound(o => o.user_track_assignment_id).Title(strings.ID_18).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.track_title).Title(strings.ID_19).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.artist_name).Title(strings.ID_8).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.full_name).Title(strings.ID_20).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.workflow_status_descr).Width(70).Title(strings.ID_22).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.deadline_date).Format("{0:MM/dd/yyyy}").Title(strings.ID_28).HtmlAttributes(new { style = "font-weight:normal" });
})
.Selectable()
.Sortable()
.Resizable(resizing => resizing.Columns(true))
.ClientEvents(events => events
.OnRowSelect("onRowSelect_AdminQueueGrid"))
.DataBinding(dataBinding => dataBinding.Ajax()
.Select("_CheckBoxesSongGrid", "RightsToolSvc", new { workflowStatus = CONSTANTS.WORKFLOWINPROGRESS }))
.Pageable(pager => pager.PageSize(20).Style(GridPagerStyles.PageInput | GridPagerStyles.NextPrevious)
.Position(GridPagerPosition.Both))
.Render();
%>
When the load increases to 700K records, it returns a timeout. We followed some other threads
in this forum and ensure that we return a IQueryable to the Grid which means that it should return
only the 20 records to the Grid no matter what the size of the db is. But in spite of that, the Grid
breaks when the record count is 700 K. We are using LINQ. I have attached portion of our code
Please suggest a fix when large amounts of data is involved
[GridAction]
public ActionResult _CheckBoxesSongGrid(int workflowStatus)
{
var adminQueueByStatus = _repository.AdminQueueByStatus(workflowStatus);
return View(new GridModel(adminQueueByStatus));
}
DB call........
/* ----------------------------------------------------------------------------
* list of songs in an admin queue by status
* ----------------------------------------------------------------------------
*/
public IQueryable<vwLstUserSongAssignment> AdminQueueByStatus(int statusID)
{
return dbMusicLicensor.vwLstUserSongAssignments.Where(p => p.workflow_status_id == statusID);
}
View.......
<div id="rhAdminInProgress">
<%
int[] checkedRecordsInProgress = (int[])ViewData["checkedRecordsInProgress"];
Html.Telerik().Grid<vwLstUserSongAssignment>()
.Name("InProgressGrid")
.Columns(columns =>
{
columns.Bound(o => o.user_track_assignment_id)
.ClientTemplate("<input type='checkbox' name='checkedRecordsInProgress' value='<#= user_track_assignment_id #>' />")
.Title(strings.ID_25)
.Width(50)
.HtmlAttributes(new { style = "text-align:center" });
columns.Bound(o => o.user_track_assignment_id).Title(strings.ID_18).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.track_title).Title(strings.ID_19).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.artist_name).Title(strings.ID_8).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.full_name).Title(strings.ID_20).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.workflow_status_descr).Width(70).Title(strings.ID_22).HtmlAttributes(new { style = "font-weight:normal" });
columns.Bound(o => o.deadline_date).Format("{0:MM/dd/yyyy}").Title(strings.ID_28).HtmlAttributes(new { style = "font-weight:normal" });
})
.Selectable()
.Sortable()
.Resizable(resizing => resizing.Columns(true))
.ClientEvents(events => events
.OnRowSelect("onRowSelect_AdminQueueGrid"))
.DataBinding(dataBinding => dataBinding.Ajax()
.Select("_CheckBoxesSongGrid", "RightsToolSvc", new { workflowStatus = CONSTANTS.WORKFLOWINPROGRESS }))
.Pageable(pager => pager.PageSize(20).Style(GridPagerStyles.PageInput | GridPagerStyles.NextPrevious)
.Position(GridPagerPosition.Both))
.Render();
%>