Calculated Column refresh

2 posts, 0 answers
  1. Dirk Liebich
    Dirk Liebich avatar
    17 posts
    Member since:
    Jun 2010

    Posted 24 Aug 2011 Link to this post


    I have a calculated column in my grid. It works pretty fine but once I change one of the correspondig fields (Qt1...Qty18) the Total column doesn't update automatically. Is it supposed to calculate only once upon loading the grid or can I somehow accomplish to calculate on the fly once a depended column changes?



    In the constructor of the code behind I have the following lines:

        Expression<Func<ForecastInputItemViewModel, double>> expression = prod => prod.Qty1 + prod.Qty2 + prod.Qty3 + prod.Qty4 + prod.Qty5 + prod.Qty6 + prod.Qty7 + prod.Qty8 + prod.Qty9 + prod.Qty10 + prod.Qty11 + prod.Qty12 + prod.Qty13 + prod.Qty14 + prod.Qty15 + prod.Qty16 + prod.Qty17 + prod.Qty18;
                GridViewExpressionColumn column = ForecastGrid.Columns["Total"] as GridViewExpressionColumn;
                column.Expression = expression;
  2. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 26 Aug 2011 Link to this post

    Hi Dirk Liebich,

     Generally the GridViewExpressionColumn cells listen to the PropertyChanged event of the row's data item in order to update themselves. Your business object should raise PropertyChanged  whenever a property of the object has changed.

    Please take a look at this online demo

    I hope that this will help you. 

    All the best,
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top