This is a migrated thread and some comments may be shown as answers.
RADGrid Footer Total
3 Answers 198 Views
This is a migrated thread and some comments may be shown as answers.
Madhu
Top achievements
Rank 1
Madhu asked on 17 Sep 2008, 05:59 PM
I have created Grid dynamically (Simply Grid is defined in .aspx file, columns are bind from code behind., no hard coded column Name) I have Combo Box outside the grid, gird loads with different column as item changes in Combo Box. 

protected

void grdSystemComponents_ItemCreated(object sender, GridItemEventArgs e){
if

(e.Item is GridDataItem && e.Item.IsInEditMode || e.Item is GridFilteringItem)
{
foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
{
if ((column is GridBoundColumn) && !((GridBoundColumn)column).ReadOnly)
{
TextBox textBox = null;
if (e.Item is GridDataItem)
{
textBox = ((
TextBox)((GridDataItem)e.Item)[column.UniqueName].Controls[0]);
textBox.Style[
"width"] = "90%";
textBox.Style[
"height"] = "11px";
textBox.Style[
"border"] = "0px";
textBox.Style[
"font-size"] = "11px";
} }

//Each column is assigned UniqueName as ID of respective Column
string
headerID = column.HeaderText;
int count = dtHeaderInfo.Rows.Count;
for (int i = 0; i < count; i++)
{
if (headerID == dtHeaderInfo.Rows[i][0].ToString())
column.UniqueName = dtHeaderInfo.Rows[i][0].ToString();
} } } }

Here are my two Issues:

1) Since Grid is set up this way, I have no idea how to calculate Footer Total for each columns. Number of column changes depending on the selected Item on Combo Box.

2) I also need to update Caluculation as user will enter number on textboxes of the Grid. In the grid, there is a column called "Tot Num", as user enter numbers here I need to update other columns on same row, user can change it but can't exceed value of "Tot Num" column. If "Tot Number" is zero, should not allow to enter number.

I need to have database interaction for calculation? How do I go go to accomplish this? Your help is much appreciated.

thansk
Madhu

3 Answers, 1 is accepted

Sort by
0
Cads
Top achievements
Rank 1
answered on 09 Nov 2009, 08:56 PM
Hi Madhu,

Did Telerik or anyone else helped you with this issue? I'm coming across the same problem since my gridview is also bound server side. I'd like have the footer populate counts especially when the user drags any heading into grouping.
0
Iana Tsolova
Telerik team
answered on 13 Nov 2009, 07:50 AM
Hello Madhu and Cads,

You can handle the ColumnCreated event of RadGrid and there set the Aggregate property for each column as desired.
And regarding the recalculations: After the user enters something in the TextBox in edit more and the changes are saved in the database after the Update buton is clicked, the totals will be automatically updated as well.
I am attaching a sample project following your scenario. Check it out and let me know if it helps.

Best wishes,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
chitralekha
Top achievements
Rank 1
answered on 16 Apr 2011, 08:50 PM
hello
I m doing a bulk entry project like excel, the coding used here is working fine when i've not hardcoded column in aspx file, but when i give the column name it is giving me ArgumentOutofRangeException in the following line :
textBox = ((TextBox)((GridDataItem)e.Item)[column.UniqueName].Controls[0]);
can u help me with this, I need to define column name.
Tags
Input
Asked by
Madhu
Top achievements
Rank 1
Answers by
Cads
Top achievements
Rank 1
Iana Tsolova
Telerik team
chitralekha
Top achievements
Rank 1
Share this question
or