I have a Telerik RadGrid in my asp.net web form Like Below :
MasterTableView
DetailTables -> GridTableView
in that detail Table i have a column like below:
<telerik:GridTableView runat="server" DataKeyNames="ID,Customer_ID,CardType_ID,OrderStatus_ID"
DataSourceID="sdsOrders" AllowFilteringByColumn="True"
AllowMultiColumnSorting="True" AllowSorting="True" ShowFooter="True" OnDataBinding="GridTableView_DataBinding">
...
<telerik:GridBoundColumn DataField="TotalPrice" DataType="System.Int32" FilterControlAltText="Filter TotalPrice column"
HeaderText="TotalPrice" SortExpression="TotalPrice"
UniqueName="TotalPrice" AllowFiltering="False" FooterText="Sum: " Aggregate="Sum">
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
</telerik:GridBoundColumn>
i want to change the color of footertext(Sum) and that (Sum) in footer.
for DataBoundColumns in MasterTableView the codes below work:
protected void GridTableView_DataBinding(object sender, EventArgs e)
{
GridBoundColumn TotalPrice = grdCustomers.MasterTableView.GetColumnSafe("TotalPrice") as GridBoundColumn;
TotalPrice.FooterAggregateFormatString = "<span class=\"AggregateTitleColor\">Sum : </span>" + "{0:#,0 ;#,0- }";
TotalPrice.FooterStyle.ForeColor = ColorTranslator.FromHtml("blue");
}
now how can i re-write those codes for that TotalPrice in DetailTable?
thanks in advance
i found the answer:
first should use DataBinding in MasterTableView.
and re-write codes like this :
protected void MasterTableView_DataBinding(object sender, EventArgs e) <- Pay Attention Here
{
GridBoundColumn TotalPrice = grdCustomers.MasterTableView.DetailTables[0].GetColumnSafe("TotalPrice") as GridBoundColumn;
TotalPrice.FooterAggregateFormatString = "<span class=\"AggregateTitleColor\">Sum : </span>" + "{0:#,0 ;#,0- }";
TotalPrice.FooterStyle.ForeColor = ColorTranslator.FromHtml("blue");
}
and you are done.