I have some custom logic that grabs a single page worth of data before setting the datasource of my RadGrid. I set the MasterTableView.VirtualItemCount. However, upon load of the page, It is telling me that I have 4 items in 1 page, thereby not giving me access to further pages. Here is my code:
ASP
<telerik:RadGrid AllowPaging="true"
AllowSorting="true"
AutoGenerateColumns="false"
GridLines="None"
ID="LoginAuditGrid"
OnNeedDataSource="LoginAuditGrid_NeedDataSource"
PageSize="4"
PagerStyle-AlwaysVisible="true"
ShowFooter="false"
ShowGroupPanel="true"
Skin="Hay"
runat="server">
<ClientSettings AllowDragToGroup="true" />
<GroupingSettings ShowUnGroupButton="true" />
<MasterTableView AllowMultiColumnSorting="true"
AllowSorting="true"
CommandItemDisplay="Top"
EnableColumnsViewState="false"
Font-Size="8">
<Columns>
<telerik:GridBoundColumn DataField="ApplicationName" DataType="System.String" HeaderText="Application Name" UniqueName="ApplicationID" />
<telerik:GridBoundColumn DataField="Username" DataType="System.String" HeaderText="Username" UniqueName="Username" />
<telerik:GridBoundColumn DataField="IPAddress" DataType="System.String" HeaderText="IP Address" UniqueName="ApplicationID" />
<telerik:GridBoundColumn DataField="LoginAuditDT" DataType="System.DateTime" HeaderText="Login Time" UniqueName="LoginAuditDT" />
<telerik:GridBoundColumn DataField="LoginAuditStatus" DataType="System.String" HeaderText="Login Audit Status" UniqueName="LoginAuditReasonID" />
<telerik:GridBoundColumn DataField="SecurityUserID" DataType="System.Int32" HeaderText="Security User ID" UniqueName="SecurityUserID" />
</Columns>
<CommandItemSettings ShowExportToExcelButton="false" ShowAddNewRecordButton="false" />
</MasterTableView>
</telerik:RadGrid>
Code Behind
protected void LoginAuditGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
//This method defines a set of criteria to filter my data on
BaseSearch criteria = new BaseSearch(SavedSearch);
List<LoginAuditDetail> data = ServiceProxy.GetService<IAdminService>().FetchLoginAudit(criteria);
LoginAuditGrid.MasterTableView.VirtualItemCount = ServiceProxy.GetService<IAdminService().FetchLoginAuditCount(criteria);
LoginAuditGrid.DataSource = data;
}
ASP
<telerik:RadGrid AllowPaging="true"
AllowSorting="true"
AutoGenerateColumns="false"
GridLines="None"
ID="LoginAuditGrid"
OnNeedDataSource="LoginAuditGrid_NeedDataSource"
PageSize="4"
PagerStyle-AlwaysVisible="true"
ShowFooter="false"
ShowGroupPanel="true"
Skin="Hay"
runat="server">
<ClientSettings AllowDragToGroup="true" />
<GroupingSettings ShowUnGroupButton="true" />
<MasterTableView AllowMultiColumnSorting="true"
AllowSorting="true"
CommandItemDisplay="Top"
EnableColumnsViewState="false"
Font-Size="8">
<Columns>
<telerik:GridBoundColumn DataField="ApplicationName" DataType="System.String" HeaderText="Application Name" UniqueName="ApplicationID" />
<telerik:GridBoundColumn DataField="Username" DataType="System.String" HeaderText="Username" UniqueName="Username" />
<telerik:GridBoundColumn DataField="IPAddress" DataType="System.String" HeaderText="IP Address" UniqueName="ApplicationID" />
<telerik:GridBoundColumn DataField="LoginAuditDT" DataType="System.DateTime" HeaderText="Login Time" UniqueName="LoginAuditDT" />
<telerik:GridBoundColumn DataField="LoginAuditStatus" DataType="System.String" HeaderText="Login Audit Status" UniqueName="LoginAuditReasonID" />
<telerik:GridBoundColumn DataField="SecurityUserID" DataType="System.Int32" HeaderText="Security User ID" UniqueName="SecurityUserID" />
</Columns>
<CommandItemSettings ShowExportToExcelButton="false" ShowAddNewRecordButton="false" />
</MasterTableView>
</telerik:RadGrid>
Code Behind
protected void LoginAuditGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
//This method defines a set of criteria to filter my data on
BaseSearch criteria = new BaseSearch(SavedSearch);
List<LoginAuditDetail> data = ServiceProxy.GetService<IAdminService>().FetchLoginAudit(criteria);
LoginAuditGrid.MasterTableView.VirtualItemCount = ServiceProxy.GetService<IAdminService().FetchLoginAuditCount(criteria);
LoginAuditGrid.DataSource = data;
}