Grand Total row formatting

3 posts, 0 answers
  1. Jim
    Jim avatar
    15 posts
    Member since:
    Oct 2012

    Posted 21 Aug 2015 Link to this post

    On my grid I am grouping by one field, and have gridview1.mastertemplate.ShowTotals = True so that I can show a grand total for columns when that grid is grouped.  My issue is that I need to change the appearance of the grand total row differently than the other (group) summary rows in ViewCellFormatting.  Is this possible, and if so how can I do it?

     

    Thanks

  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 24 Aug 2015 Link to this post

    Hello Jim,

    Thank you for writing.

    In my tests the total summary rows did not have their Group property set, so you can try identifying them with this. Here is a sample:
    private void RadGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
    {
        if (e.CellElement is GridSummaryCellElement && e.Row.Group == null)
        {
            e.CellElement.DrawFill = true;
            e.CellElement.BackColor = Color.Red;
            e.CellElement.GradientStyle = GradientStyles.Solid;
        }
        else
        {
            e.CellElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
            e.CellElement.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local);
            e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local);
        }
    }

    Let me know how this works for you.

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jim
    Jim avatar
    15 posts
    Member since:
    Oct 2012

    Posted 03 Sep 2015 in reply to Stefan Link to this post

    Perfect.  Thanks!
Back to Top