Hi Team,
I have a radgrid with a template column that has numeric values bound to it.
I want to show the sum of all values in a column footer. I tried using Aggregate="Sum" but it gives the sum of values on a single page.
My grid has almost 200 pages and I want to show the sum of ALL values in that column in column footer.
Here is my grid:
<telerik:RadGrid ID="rgGLLineItem" runat="server" OnNeedDataSource="rgGLLineItem_NeedDataSource" OnItemDataBound="rgGLLineItem_ItemDataBound" AllowFilteringByColumn="true" CssClass="GridHieght" ShowFooter="true">
<MasterTableView>
<Columns>
<telerik:GridTemplateColumn DataField="AmountInLocalCurr" HeaderText="Amount In LocalCurr." UniqueName="AmountInLocalCurrency" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" >
<ItemTemplate>
<asp:Label ID="lblAmountInLocalCurr" runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.AmountInLocalCurr","{0:N}") %>' />
<asp:Label ID="lblCrDr" runat="server" />
</ItemTemplate>
<FooterStyle HorizontalAlign="Right"/>
<ItemStyle HorizontalAlign="Right" />
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<GroupingSettings CaseSensitive="False" />
<ClientSettings Scrolling-AllowScroll="true" Scrolling-UseStaticHeaders="true" ClientEvents-OnMasterTableViewCreating="SetGridHeight"></ClientSettings>
</telerik:RadGrid>
Another problems is with the Filters. As this column is Template column, with no specific data type specified, I think it should accept string input as well. Because, in ItemDataBound Event, I am setting a text to the label lblCrDr , Cr or Dr depending upon the value of a column.
This is the DataBound Event:
if (e.Item is GridDataItem)
{
GridDataItem item = e.Item as GridDataItem;
Label lblCrDr = (Label)item.FindControl("lblCrDr");
if (item["AccountJournalEventCRDR"].Text == "1")
{
lblCrDr.ForeColor = System.Drawing.Color.Red;
lblCrDr.Text = "(Cr) ";
}
if (item["AccountJournalEventCRDR"].Text == "2")
{
lblCrDr.ForeColor = System.Drawing.Color.Gray;
lblCrDr.Text = "(Dr) ";
}
}
Could you please help me on this?
Any help appreciated.
Thanks,
Lok..
I have a radgrid with a template column that has numeric values bound to it.
I want to show the sum of all values in a column footer. I tried using Aggregate="Sum" but it gives the sum of values on a single page.
My grid has almost 200 pages and I want to show the sum of ALL values in that column in column footer.
Here is my grid:
<telerik:RadGrid ID="rgGLLineItem" runat="server" OnNeedDataSource="rgGLLineItem_NeedDataSource" OnItemDataBound="rgGLLineItem_ItemDataBound" AllowFilteringByColumn="true" CssClass="GridHieght" ShowFooter="true">
<MasterTableView>
<Columns>
<telerik:GridTemplateColumn DataField="AmountInLocalCurr" HeaderText="Amount In LocalCurr." UniqueName="AmountInLocalCurrency" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" >
<ItemTemplate>
<asp:Label ID="lblAmountInLocalCurr" runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.AmountInLocalCurr","{0:N}") %>' />
<asp:Label ID="lblCrDr" runat="server" />
</ItemTemplate>
<FooterStyle HorizontalAlign="Right"/>
<ItemStyle HorizontalAlign="Right" />
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<GroupingSettings CaseSensitive="False" />
<ClientSettings Scrolling-AllowScroll="true" Scrolling-UseStaticHeaders="true" ClientEvents-OnMasterTableViewCreating="SetGridHeight"></ClientSettings>
</telerik:RadGrid>
Another problems is with the Filters. As this column is Template column, with no specific data type specified, I think it should accept string input as well. Because, in ItemDataBound Event, I am setting a text to the label lblCrDr , Cr or Dr depending upon the value of a column.
This is the DataBound Event:
if (e.Item is GridDataItem)
{
GridDataItem item = e.Item as GridDataItem;
Label lblCrDr = (Label)item.FindControl("lblCrDr");
if (item["AccountJournalEventCRDR"].Text == "1")
{
lblCrDr.ForeColor = System.Drawing.Color.Red;
lblCrDr.Text = "(Cr) ";
}
if (item["AccountJournalEventCRDR"].Text == "2")
{
lblCrDr.ForeColor = System.Drawing.Color.Gray;
lblCrDr.Text = "(Dr) ";
}
}
Could you please help me on this?
Any help appreciated.
Thanks,
Lok..