This question is locked. New answers and comments are not allowed.
It appears that our grids load all the data on initial load and then decides the number of pages. But when you go to the another page the grid appears to re-fetch the data from the Database and reloads the grid. Am I missing something? I have looked for the answer everywhere and still cannot find one.
the grid:
<% Html.Telerik().Grid(Model)
.Name("Grid")
.HtmlAttributes(new { @class = "cust_search_grid" })
.ClientEvents(events => events
.OnRowSelect("Grid_onRowSelect")
.OnLoad("Grid_onLoad")
//.OnDataBinding("Grid_onDataBinding")
.OnDataBound("Grid_onDataBound")
.OnEdit("Grid_onEdit")
.OnDelete("Grid_onDelete")
.OnError("Grid_onError")
)
.DataKeys(keys => keys.Add(c => c.Id))
.ToolBar( toolBar => toolBar.Template(() =>
{ %>
<button type="button" id="selectAll">Select All Records</button>
<button type="button" id="deselectAll">Clear Selection</button>
<label class="customer-label" for="Customers-input">Tag selected:</label>
<%// ReSharper disable ConvertToLambdaExpression
Html.Telerik().ComboBox()
.Name("Tags")
.DataBinding(binding =>
binding.Ajax().Select("GetTags", "Customers"))
.ClientEvents(events => events
.OnError("RedirectOnError")
)
.AutoFill(true)
.HtmlAttributes(new { style = "width: 200px" })
.HighlightFirstMatch(true)
.Render();
// ReSharper restore ConvertToLambdaExpression%>
<button type="button" id="tagApply">Apply Tag</button>
<button type="button" id="tagRemove">Remove Tag</button>
<button type="button" id="getAuditAuthReport">Download Audit Authorization</button>
<button type="button" id="uploadReport">Documents</button>
<div style="font-weight: bold;">Selected Customers: <span id="custCount">0</span></div>
<%}))
.Columns(columns =>
{
columns.Bound(c => c.Id).
ClientTemplate("<input type='checkbox' name='checkedCustomers' class='selectedCustomer' value='<#= Id #>' />")
.Title("")
.Width(35).HtmlAttributes(new { style = "text-align:center" })
.ReadOnly(true).Filterable(false)
.Sortable(false);
columns.Command(commands =>
{
commands.Delete().ButtonType(GridButtonType.Image).HtmlAttributes(new { style = "width: 15px; min-width: 15px;" });
commands.Edit().ButtonType(GridButtonType.Image).HtmlAttributes(new { style = "width: 15px; min-width: 15px;" });
})
.Width(80);
columns.Bound(c => c.CustomerNumber).Width(100);
columns.Bound(c => c.Company).Width(230);
columns.Bound(c => c.ApplicationId).Width(160);
columns.Bound(c => c.DeliveryUtilityAccountNumbers).Width(180);
columns.Bound(c => c.ContactPerson).Width(170);
columns.Bound(c => c.ContactPhoneNumber).Width(220);
columns.Bound(c => c.ServiceZip).Width(140);
columns.Bound(c => c.EmailAddress).Width(170);
columns.Bound(c => c.BusinessCategory).Width(190);
columns.Bound(c => c.Tags).Width(110).ReadOnly(true);
//columns.Bound(c => c.Title).Width(50);
columns.Bound(c => c.AlternatePhoneNumber).Width(230);
columns.Bound(c => c.BillingAddress1).Width(180);
columns.Bound(c => c.BillingAddress2).Width(180);
columns.Bound(c => c.BillingCity).Width(150);
columns.Bound(c => c.BillingState).Width(150);
columns.Bound(c => c.BillingZip).Width(140);
columns.Bound(c => c.ServiceAddress1).Width(190);
columns.Bound(c => c.ServiceAddress2).Width(190);
columns.Bound(c => c.ServiceCity).Width(150);
columns.Bound(c => c.ServiceState).Width(160);
columns.Bound(c => c.AverageEnergyDemand).Width(270);
columns.Bound(c => c.AverageEnergyConsumption).Width(280);
columns.Bound(c => c.SupplyUtilityAccountNumbers).Width(250);
columns.Bound(c => c.AverageEnergyDemandUnit).Width(270);
columns.Bound(c => c.AverageEnergyConsumptionUnit).Width(270);
columns.Bound(c => c.PremiseNumber).Width(160);
columns.Bound(c => c.MeterNumber).Width(160);
columns.Bound(c => c.TarrifType).Width(140);
columns.Bound(c => c.FacilityName).Width(160);
columns.Bound(c => c.RelatedFacebookAccounts).Width(200);
columns.Bound(c => c.RelatedTwitterAccounts).Width(190);
columns.Bound(c => c.BusinessWebsite).Width(170);
columns.Bound(c => c.ProgramParticipation).Width(210);
columns.Bound(c => c.Accepted).ClientTemplate("<#= Accepted?\"<img alt='true' src='" + Url.Content("~/Content/Images/true.jpg") + "' />\":\"\" #>").Width(150);
columns.Bound(c => c.AppId).Hidden(true);
columns.Bound(c => c.FacilityId).Hidden(true);
})
.DataBinding(dataBinding => dataBinding
.Ajax()
.Select("DoSearch", "Customers")
.Delete("DoDelete", "Customers")
.Update("Update", "Customers")
)
.Scrollable(scrolling => scrolling.Height(300))
.Resizable(resizing => resizing.Columns(true))
.Reorderable(reorder => reorder.Columns(true))
.Sortable()
.Filterable()
.Pageable(paging =>
paging.PageSize(50))
.Selectable()
.Render();
%>
<% Html.Telerik().ScriptRegistrar().OnDocumentReady(() =>
{
%>
the grid:
<% Html.Telerik().Grid(Model)
.Name("Grid")
.HtmlAttributes(new { @class = "cust_search_grid" })
.ClientEvents(events => events
.OnRowSelect("Grid_onRowSelect")
.OnLoad("Grid_onLoad")
//.OnDataBinding("Grid_onDataBinding")
.OnDataBound("Grid_onDataBound")
.OnEdit("Grid_onEdit")
.OnDelete("Grid_onDelete")
.OnError("Grid_onError")
)
.DataKeys(keys => keys.Add(c => c.Id))
.ToolBar( toolBar => toolBar.Template(() =>
{ %>
<button type="button" id="selectAll">Select All Records</button>
<button type="button" id="deselectAll">Clear Selection</button>
<label class="customer-label" for="Customers-input">Tag selected:</label>
<%// ReSharper disable ConvertToLambdaExpression
Html.Telerik().ComboBox()
.Name("Tags")
.DataBinding(binding =>
binding.Ajax().Select("GetTags", "Customers"))
.ClientEvents(events => events
.OnError("RedirectOnError")
)
.AutoFill(true)
.HtmlAttributes(new { style = "width: 200px" })
.HighlightFirstMatch(true)
.Render();
// ReSharper restore ConvertToLambdaExpression%>
<button type="button" id="tagApply">Apply Tag</button>
<button type="button" id="tagRemove">Remove Tag</button>
<button type="button" id="getAuditAuthReport">Download Audit Authorization</button>
<button type="button" id="uploadReport">Documents</button>
<div style="font-weight: bold;">Selected Customers: <span id="custCount">0</span></div>
<%}))
.Columns(columns =>
{
columns.Bound(c => c.Id).
ClientTemplate("<input type='checkbox' name='checkedCustomers' class='selectedCustomer' value='<#= Id #>' />")
.Title("")
.Width(35).HtmlAttributes(new { style = "text-align:center" })
.ReadOnly(true).Filterable(false)
.Sortable(false);
columns.Command(commands =>
{
commands.Delete().ButtonType(GridButtonType.Image).HtmlAttributes(new { style = "width: 15px; min-width: 15px;" });
commands.Edit().ButtonType(GridButtonType.Image).HtmlAttributes(new { style = "width: 15px; min-width: 15px;" });
})
.Width(80);
columns.Bound(c => c.CustomerNumber).Width(100);
columns.Bound(c => c.Company).Width(230);
columns.Bound(c => c.ApplicationId).Width(160);
columns.Bound(c => c.DeliveryUtilityAccountNumbers).Width(180);
columns.Bound(c => c.ContactPerson).Width(170);
columns.Bound(c => c.ContactPhoneNumber).Width(220);
columns.Bound(c => c.ServiceZip).Width(140);
columns.Bound(c => c.EmailAddress).Width(170);
columns.Bound(c => c.BusinessCategory).Width(190);
columns.Bound(c => c.Tags).Width(110).ReadOnly(true);
//columns.Bound(c => c.Title).Width(50);
columns.Bound(c => c.AlternatePhoneNumber).Width(230);
columns.Bound(c => c.BillingAddress1).Width(180);
columns.Bound(c => c.BillingAddress2).Width(180);
columns.Bound(c => c.BillingCity).Width(150);
columns.Bound(c => c.BillingState).Width(150);
columns.Bound(c => c.BillingZip).Width(140);
columns.Bound(c => c.ServiceAddress1).Width(190);
columns.Bound(c => c.ServiceAddress2).Width(190);
columns.Bound(c => c.ServiceCity).Width(150);
columns.Bound(c => c.ServiceState).Width(160);
columns.Bound(c => c.AverageEnergyDemand).Width(270);
columns.Bound(c => c.AverageEnergyConsumption).Width(280);
columns.Bound(c => c.SupplyUtilityAccountNumbers).Width(250);
columns.Bound(c => c.AverageEnergyDemandUnit).Width(270);
columns.Bound(c => c.AverageEnergyConsumptionUnit).Width(270);
columns.Bound(c => c.PremiseNumber).Width(160);
columns.Bound(c => c.MeterNumber).Width(160);
columns.Bound(c => c.TarrifType).Width(140);
columns.Bound(c => c.FacilityName).Width(160);
columns.Bound(c => c.RelatedFacebookAccounts).Width(200);
columns.Bound(c => c.RelatedTwitterAccounts).Width(190);
columns.Bound(c => c.BusinessWebsite).Width(170);
columns.Bound(c => c.ProgramParticipation).Width(210);
columns.Bound(c => c.Accepted).ClientTemplate("<#= Accepted?\"<img alt='true' src='" + Url.Content("~/Content/Images/true.jpg") + "' />\":\"\" #>").Width(150);
columns.Bound(c => c.AppId).Hidden(true);
columns.Bound(c => c.FacilityId).Hidden(true);
})
.DataBinding(dataBinding => dataBinding
.Ajax()
.Select("DoSearch", "Customers")
.Delete("DoDelete", "Customers")
.Update("Update", "Customers")
)
.Scrollable(scrolling => scrolling.Height(300))
.Resizable(resizing => resizing.Columns(true))
.Reorderable(reorder => reorder.Columns(true))
.Sortable()
.Filterable()
.Pageable(paging =>
paging.PageSize(50))
.Selectable()
.Render();
%>
<% Html.Telerik().ScriptRegistrar().OnDocumentReady(() =>
{
%>