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

Template Column Footer is not updated

3 Answers 36 Views
Grid
This is a migrated thread and some comments may be shown as answers.
chirag
Top achievements
Rank 1
chirag asked on 10 Nov 2008, 04:03 PM
I have a Grid that allows users to enter numbers in all the rows and displays the totals at the bottom. To achieve this I used a GridTemplateColumn with RadNumericTextBox textbox in it. It itemtemplate is shown below 
<ItemTemplate>
            <telerik:RadNumericTextBox ID="Number" runat="server" MinValue="0" MaxValue="1800000000" NumberFormat-AllowRounding="true" Width="90px" NumberFormat-DecimalDigits="0" Skin="Office2007" OnTextChanged="Number_TextChanged" AutoPostBack="true"></telerik:RadNumericTextBox>
</ItemTemplate>

On the textchanged event I loop through all the rows and calculate the total at follows

foreach (GridDataItem gr in radGrid1.MasterTableView.Items)
            {
                RadNumericTextBox Number = (RadNumericTextBox)gr.FindControl("Number");
                lTotal += long.Parse(Math.Round(Number.Value.Value, 0).ToString());
            }

and then I display it in the footer as follows:

radGrid1.MasterTableView.Columns[8].FooterText = string.Format("{0:0,000}",lTotal );

This does not update the footer text. Please help.


3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 Nov 2008, 05:57 AM
Hi Chirag,

Try rebinding the Grid after setting FooterText in the TextChanged event as shown below.

CS:
 radGrid1.MasterTableView.Columns[8].FooterText = string.Format("{0:0,000}", lTotal); 
            radGrid1.MasterTableView.Rebind(); 


Regards
Shinu.
0
chirag
Top achievements
Rank 1
answered on 11 Nov 2008, 02:39 PM
Thanks Shinu, My problem is that I dont want to rebind, rebind will cause needdatasource to fire and i will loose all the changes the user made.
0
Accepted
Shinu
Top achievements
Rank 2
answered on 12 Nov 2008, 05:06 AM
Hi Chirag,

You can achieve the same from client side as shown in the online demo.
RadNumericTextBox for RadGrid Footer Totals

Shinu.
Tags
Grid
Asked by
chirag
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
chirag
Top achievements
Rank 1
Share this question
or