This is a migrated thread and some comments may be shown as answers.

Display total grid rows in footer

2 Answers 374 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kiran
Top achievements
Rank 1
Kiran asked on 03 Aug 2010, 09:18 PM
Hi there,

How can i display the total grid rows in the footer ?

here is my grid, You can see there is a column "Department" I want to display the total grid rows in the footer of department column,

 

<telerik:RadGrid ID="RadGrid1" ShowFooter="true"

 

 

Width="99%" EnableLinqExpressions="false" FooterStyle-CssClass="GridColHeadNormal"

 

 

AllowSorting="True" runat="server">

 

 

 

<MasterTableView ClientDataKeyNames="KEYID">

 

 

<Columns>

 

 

 

 

<telerik:GridBoundColumn HeaderText="Employee Name" DataField="Name" UniqueName="Name"

 

 

SortExpression="Name" FilterControlWidth="130" AutoPostBackOnFilter="true"

 

 

CurrentFilterFunction="contains" ShowFilterIcon="false" />

 

 

 

<telerik:GridBoundColumn HeaderText="SSN" DataField="EMP_SSN"

 

 

UniqueName="SSN" SortExpression="EMP_SSN" FilterControlWidth="100" AutoPostBackOnFilter="true"

 

 

CurrentFilterFunction="contains" ShowFilterIcon="false" />

 

 

 

<telerik:GridBoundColumn HeaderText="Pay Period" DataField="CODE" SortExpression="CODE"

 

 

UniqueName="CODE" AutoPostBackOnFilter="true">

 

 

<FilterTemplate>

 

 

<telerik:RadComboBox ID="RadComboBoxPP" DataSourceID="SqlDataSourcePP" DataTextField="Code" Width="100"

 

 

DataValueField="Code" Height="100px" AppendDataBoundItems="true" OnClientSelectedIndexChanged="SelectedIndexChanged"

 

 

SelectedValue='<%# TryCast(Container, GridItem).OwnerTableView.GetColumn("Code").CurrentFilterValue %>'

 

 

runat="server">

 

 

<Items>

 

 

<telerik:RadComboBoxItem Text="All" />

 

 

</Items>

 

 

</telerik:RadComboBox>

 

 

<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">

 

 

<script type="text/javascript">

 

 

function SelectedIndexChanged(sender,args) {

 

 

var tableView=$find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID %>");

 

sender.value= args.get_item().get_value();

tableView.filter(

"CODE",args.get_item().get_value(),"EqualTo");

 

}

 

</script>

 

 

</telerik:RadScriptBlock>

 

 

</FilterTemplate>

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn HeaderText="Department" DataField="Department" SortExpression="Department"

 

 

UniqueName="Department" AutoPostBackOnFilter="true">

 

 

 

<FilterTemplate>

 

 

<telerik:RadComboBox ID="RadComboBoxDep" DataSourceID="SqlDataSourceDepartment" DataTextField="Department"

 

 

DataValueField="Department" Height="100px" AppendDataBoundItems="true" OnClientSelectedIndexChanged="SelectedIndexChanged2"

 

 

SelectedValue='<%# TryCast(Container, GridItem).OwnerTableView.GetColumn("Department").CurrentFilterValue %>'

 

 

runat="server">

 

 

<Items>

 

 

<telerik:RadComboBoxItem Text="All" />

 

 

</Items>

 

 

</telerik:RadComboBox>

 

 

<telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">

 

 

<script type="text/javascript">

 

 

function SelectedIndexChanged2(sender,args) {

 

 

var tableView=$find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID %>");

 

sender.value= args.get_item().get_value();

tableView.filter(

"Department",args.get_item().get_value(),"EqualTo");

 

}

 

</script>

 

 

</telerik:RadScriptBlock>

 

 

 

</FilterTemplate>

 

 

<FooterStyle CssClass="GridColHeadNormal" />

 

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridNumericColumn Aggregate="Count" DataField="KEYID" Display="false"

 

 

UniqueName="KEYID" SortExpression="KEYID" ShowFilterIcon="false" AllowFiltering="false" />

 

 

</Columns>

 

 

</MasterTableView>

 

 

<ClientSettings >

 

 

 

 

<ClientEvents OnGridCreated="GridCreated" OnRowSelected="RowSelected" />

 

 

</ClientSettings>

 

 

 

</telerik:RadGrid>

 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 04 Aug 2010, 08:20 AM
Hi Kiran,

Set the Aggregate property of GridBoundcolumn as Count to show number of total grid rows for the corresponding column footer.

Here you can find more information about Column Aggregates
  http://www.telerik.com/help/aspnet-ajax/grdcolumnaggregates.html

-Shinu.
0
Kiran
Top achievements
Rank 1
answered on 04 Aug 2010, 02:38 PM
Thank you Shinu

Kiran
Tags
General Discussions
Asked by
Kiran
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Kiran
Top achievements
Rank 1
Share this question
or