bind textbox to footer's aggregate result

11 posts, 0 answers
  1. Johnny
    Johnny avatar
    30 posts
    Member since:
    Jan 2012

    Posted 29 Feb 2012 Link to this post

    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

     

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 01 Mar 2012 Link to this post

    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 >>
  3. Johnny
    Johnny avatar
    30 posts
    Member since:
    Jan 2012

    Posted 01 Mar 2012 Link to this post

    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
  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 02 Mar 2012 Link to this post

    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 >>
  5. Johnny
    Johnny avatar
    30 posts
    Member since:
    Jan 2012

    Posted 02 Mar 2012 Link to this post

    There is no other way around to accomplish this? It there any handling for clicking different tab and trigger the update of the value?
  6. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 05 Mar 2012 Link to this post

    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 >>
  7. Johnny
    Johnny avatar
    30 posts
    Member since:
    Jan 2012

    Posted 05 Mar 2012 Link to this post

    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?
  8. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 06 Mar 2012 Link to this post

    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 >>
  9. Johnny
    Johnny avatar
    30 posts
    Member since:
    Jan 2012

    Posted 07 Mar 2012 Link to this post

    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.
  10. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 08 Mar 2012 Link to this post

    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 >>
  11. Johnny
    Johnny avatar
    30 posts
    Member since:
    Jan 2012

    Posted 08 Mar 2012 Link to this post

    Thanks, but it's still very difficult for me to understand. May be I start a new threat.
Back to Top