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

GridViewSummaryRow

1 Answer 124 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 17 Sep 2010, 04:29 PM
Hi,

I have created a grid that needs to show totals and highlight the totals if they exceed a certain amount.  Like a time sheet going over 40 hours for a week or  8 hours in a single day.

I have not been able to find a way to capture the CellElement to modify the GridViewSummaryRow cells.

I have tried a few different ways such as the following.

   private void rg_CellFormatting(object sender, CellFormattingEventArgs e)
        {

            if (e.CellElement is Telerik.WinControls.UI.GridSummaryCellElement)
            {
                e.CellElement.DrawFill = true;
                e.CellElement.NumberOfColors = 1;
                e.CellElement.BackColor = Color.Crimson;
                e.CellElement.Font = new Font("Verdana", 10);
            }

}

I never see a GridSummaryCellElement come up during the formatting.  I was wondering if I am just going about it wrong or maybe its the order in which I am constructing my grid?

Quick view of my load:
            BuildGrid();
            PinColumns();
            BindGrid();
            CreateSummaryRow();

I can provide more detail if needed.

Any thoughts?

Thanks,

Chris


1 Answer, 1 is accepted

Sort by
0
Christopher
Top achievements
Rank 1
answered on 20 Sep 2010, 10:21 PM
Here's the solution in case anyone was following this post.
 Thanks to the Telerik Team.

Need to be using the ViewCellFormatting event to get the summary row CellElement

Font summaryCellFont = newFont("Verdana", 10);
 
void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    if(e.CellElement isTelerik.WinControls.UI.GridSummaryCellElement)
    {
        e.CellElement.DrawFill = true;
        e.CellElement.NumberOfColors = 1;
        e.CellElement.BackColor = Color.Crimson;
        e.CellElement.Font = summaryCellFont;
    }
    else
    {
        e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, Telerik.WinControls.ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.NumberOfColorsProperty, Telerik.WinControls.ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.FontProperty, Telerik.WinControls.ValueResetFlags.Local);
    }
}
Tags
GridView
Asked by
Christopher
Top achievements
Rank 1
Answers by
Christopher
Top achievements
Rank 1
Share this question
or