Hi,
I have seen the answer follow path: http://www.telerik.com/community/forums/aspnet-ajax/grid/total-record-count-after-filter.aspx but i can not fix this error. My scario is below:
1. ASPX Page:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="radGridControl">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="radGridControl" LoadingPanelID="RadAjaxLoadingPanel1"/>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="50px" Width="75px" Transparency="25" >
<img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border:0;" />
</telerik:RadAjaxLoadingPanel>
<telerik:RadFilter runat="server" ID="radFilter" OnApplyExpressions="radFilter_SearchGridData" CssClass="hoanguyen-GridStyleRow">
<FieldEditors>
<telerik:RadFilterTextFieldEditor DisplayName = "Languge Code" FieldName="LangugeCode" TextBoxWidth="120" />
<telerik:RadFilterTextFieldEditor DisplayName = "Languge Name" FieldName="LangugeName" TextBoxWidth="120" />
</FieldEditors>
</telerik:RadFilter>
</div>
</td>
</tr>
<tr>
<td >
<telerik:RadGrid
Width="99.8%" ID="radGridControl"
runat="server"
AutoGenerateColumns="False"
AllowSorting="true"
AllowPaging="True"
AllowCustomPaging="true"
AllowMultiRowSelection="True"
CellPadding="0" PageSize="10"
VirtualItemCount="100000"
OnNeedDataSource="radGridControl_NeedDataSource"
AllowFilteringByColumn="true"
OnPreRender ="radGridControl_PreRender"
>
<PagerStyle Mode="NumericPages" CssClass = "hoanguyen-GridStyleRow" />
<MasterTableView IsFilterItemExpanded="false" Font-Bold="False" TableLayout="Fixed">
<Columns>
<telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn">
<ItemTemplate>
<asp:CheckBox ID="chkItem" runat="server" />
</ItemTemplate>
<HeaderTemplate>
<asp:CheckBox ID="headerChkbox" runat="server" OnCheckedChanged="ToggleSelectedState" AutoPostBack="True" />
</HeaderTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="LanguageCode" HeaderText="Language Code" UniqueName="colLanguageCode">
<ItemStyle CssClass="hoanguyen-GridStyleRow" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LanguageName" HeaderText="Language Name" UniqueName="colLanguageName">
<ItemStyle CssClass="hoanguyen-GridStyleRow" />
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings EnableRowHoverStyle="True">
<Selecting AllowRowSelect="True" />
<ClientEvents OnRowSelected="RowSelected" />
<Scrolling
AllowScroll="True"
ScrollHeight="320"
EnableVirtualScrollPaging="True"
UseStaticHeaders="True" />
</ClientSettings>
<AlternatingItemStyle Height="20px" />
<ItemStyle Height="20px" />
<HeaderStyle Height="20px" CssClass="hoanguyen-GridStyleRow" Font-Bold="True" />
</telerik:RadGrid>
2. Code-behid:
protected void radGridControl_PreRender(object sender, EventArgs e)
{
if (check)
{
radGridControl.AllowPaging = false;
radGridControl.Rebind();
int intRecordCount = radGridControl.MasterTableView.Items.Count;
radGridControl.AllowPaging = true;
radGridControl.AllowCustomPaging = true;
radGridControl.Rebind();
}
}
protected void radFilter_SearchGridData(object sender, RadFilterApplyExpressionsEventArgs e)
{
RadFilterSqlQueryProvider provider = new RadFilterSqlQueryProvider();
provider.ProcessGroup(e.ExpressionRoot);
radGridControl.MasterTableView.FilterExpression = provider.Result;
radGridControl.Rebind();
check = true;
}
Note: "int intRecordCount = radGridControl.MasterTableView.Items.Count;" line is still error because the result is row count for earch page. It is not total rows on grid after click event "OnApplyExpressions="radFilter_SearchGridData" of Filter.
Please, do you help me this problem?
Thansks,
Mr PhuongLD
I have seen the answer follow path: http://www.telerik.com/community/forums/aspnet-ajax/grid/total-record-count-after-filter.aspx but i can not fix this error. My scario is below:
1. ASPX Page:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="radGridControl">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="radGridControl" LoadingPanelID="RadAjaxLoadingPanel1"/>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="50px" Width="75px" Transparency="25" >
<img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border:0;" />
</telerik:RadAjaxLoadingPanel>
<telerik:RadFilter runat="server" ID="radFilter" OnApplyExpressions="radFilter_SearchGridData" CssClass="hoanguyen-GridStyleRow">
<FieldEditors>
<telerik:RadFilterTextFieldEditor DisplayName = "Languge Code" FieldName="LangugeCode" TextBoxWidth="120" />
<telerik:RadFilterTextFieldEditor DisplayName = "Languge Name" FieldName="LangugeName" TextBoxWidth="120" />
</FieldEditors>
</telerik:RadFilter>
</div>
</td>
</tr>
<tr>
<td >
<telerik:RadGrid
Width="99.8%" ID="radGridControl"
runat="server"
AutoGenerateColumns="False"
AllowSorting="true"
AllowPaging="True"
AllowCustomPaging="true"
AllowMultiRowSelection="True"
CellPadding="0" PageSize="10"
VirtualItemCount="100000"
OnNeedDataSource="radGridControl_NeedDataSource"
AllowFilteringByColumn="true"
OnPreRender ="radGridControl_PreRender"
>
<PagerStyle Mode="NumericPages" CssClass = "hoanguyen-GridStyleRow" />
<MasterTableView IsFilterItemExpanded="false" Font-Bold="False" TableLayout="Fixed">
<Columns>
<telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn">
<ItemTemplate>
<asp:CheckBox ID="chkItem" runat="server" />
</ItemTemplate>
<HeaderTemplate>
<asp:CheckBox ID="headerChkbox" runat="server" OnCheckedChanged="ToggleSelectedState" AutoPostBack="True" />
</HeaderTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="LanguageCode" HeaderText="Language Code" UniqueName="colLanguageCode">
<ItemStyle CssClass="hoanguyen-GridStyleRow" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="LanguageName" HeaderText="Language Name" UniqueName="colLanguageName">
<ItemStyle CssClass="hoanguyen-GridStyleRow" />
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings EnableRowHoverStyle="True">
<Selecting AllowRowSelect="True" />
<ClientEvents OnRowSelected="RowSelected" />
<Scrolling
AllowScroll="True"
ScrollHeight="320"
EnableVirtualScrollPaging="True"
UseStaticHeaders="True" />
</ClientSettings>
<AlternatingItemStyle Height="20px" />
<ItemStyle Height="20px" />
<HeaderStyle Height="20px" CssClass="hoanguyen-GridStyleRow" Font-Bold="True" />
</telerik:RadGrid>
2. Code-behid:
protected void radGridControl_PreRender(object sender, EventArgs e)
{
if (check)
{
radGridControl.AllowPaging = false;
radGridControl.Rebind();
int intRecordCount = radGridControl.MasterTableView.Items.Count;
radGridControl.AllowPaging = true;
radGridControl.AllowCustomPaging = true;
radGridControl.Rebind();
}
}
protected void radFilter_SearchGridData(object sender, RadFilterApplyExpressionsEventArgs e)
{
RadFilterSqlQueryProvider provider = new RadFilterSqlQueryProvider();
provider.ProcessGroup(e.ExpressionRoot);
radGridControl.MasterTableView.FilterExpression = provider.Result;
radGridControl.Rebind();
check = true;
}
Note: "int intRecordCount = radGridControl.MasterTableView.Items.Count;" line is still error because the result is row count for earch page. It is not total rows on grid after click event "OnApplyExpressions="radFilter_SearchGridData" of Filter.
Please, do you help me this problem?
Thansks,
Mr PhuongLD