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

bind textbox to footer's aggregate result

10 Answers 105 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Johnny
Top achievements
Rank 1
Johnny asked on 01 Mar 2012, 02:48 AM
Hi,

I would like to have a seperate textbox, right next to the grid, to display the aggregate result from the grid. To calculate the aggregate result from one of the columns from my grid, I have this

Column.Expression = ColumnExpression;

var totalAggregate = new AggregateFunction<GridColumns, double>

{

AggregationExpression = adjustedColumns => adjustedColumns.Sum(a*b)

Caption = " Total: "

};

ColumnExpression.AggregateFunctions.Add(totalAggregate);

And for my textbox, I have this:

 

Binding binding = new Binding("TotalAggregate");

 

binding.Source = adjustedTotalAggregate.ToString();

binding.Mode = BindingMode.OneWay;  

textBox1.SetBinding(TextBox.TextProperty, binding);

Although it doesn't give me any error, but the result from my aggregate result doesn't showes up in the textbox. I wonder how this is usually done. Thank you very much

 

10 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 01 Mar 2012, 09:20 AM
Hello,

 Please check this forum thread for an example on how this could be done.

All the best,
Didie
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Johnny
Top achievements
Rank 1
answered on 01 Mar 2012, 08:11 PM
Thank you for the reply. It works perfectly.

I have one more questions, how can I pass that same value from one tab to another tab? Let's say that I have the grid sits in tab1, and I would like to by pass the aggregate result to a textbox sits in tab2? How can I do it? Thanks
0
Dimitrina
Telerik team
answered on 02 Mar 2012, 02:13 PM
Hello,

Unfortunately you cannot bind to a value that is in a different tab. I would recommend you to work directly with your underlying data, rather then with the values calculated by the GridView.

Regards,
Didie
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Johnny
Top achievements
Rank 1
answered on 02 Mar 2012, 09:29 PM
There is no other way around to accomplish this? It there any handling for clicking different tab and trigger the update of the value?
0
Dimitrina
Telerik team
answered on 05 Mar 2012, 10:24 AM
Hi,

 Unfortunately I cannot suggest such a workaround. 

Greetings,
Didie
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Johnny
Top achievements
Rank 1
answered on 06 Mar 2012, 03:49 AM
How about saving all of the elements in the grid into an array and let the text fileld in the sencond tab read from the list?
0
Dimitrina
Telerik team
answered on 06 Mar 2012, 08:54 AM
Hello,

 Indeed, this would be good. That way you can populate the saved values as desired.

Regards,
Didie
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Johnny
Top achievements
Rank 1
answered on 07 Mar 2012, 11:08 PM
Do you have some example to show how to save the data row-by-row inside a grid? I am new to telerik API and i would like to get some help from you. Is there any methods that allows me to go through row by row and save the data? Thanks so much.
0
Dimitrina
Telerik team
answered on 08 Mar 2012, 04:45 PM
Hello,

 You can review the source code of this online demo for an example. Please especially note how the document to be printed is created.

All the best,
Didie
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Johnny
Top achievements
Rank 1
answered on 09 Mar 2012, 04:32 AM
Thanks, but it's still very difficult for me to understand. May be I start a new threat.
Tags
GridView
Asked by
Johnny
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Johnny
Top achievements
Rank 1
Share this question
or