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

How to acess filter row bar cells in gridview

3 Answers 101 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Teng Mua
Top achievements
Rank 1
Teng Mua asked on 29 Apr 2011, 12:16 AM
I would like to change the filter row cells background color. Please assist I can't seem to access via code or editor tools.

Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 29 Apr 2011, 11:34 AM
Hello Teng Mua,

Just handle the ViewRowFormatting event, like so:
void radGridView1_ViewRowFormatting(object sender, RowFormattingEventArgs e)
{
    if (e.RowElement is GridFilterRowElement)
    {
        e.RowElement.BackColor = Color.Yellow;
        e.RowElement.NumberOfColors = 1;
        e.RowElement.DrawFill = true;
    }
    else
    {
        e.RowElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
        e.RowElement.ResetValue(LightVisualElement.NumberOfColorsProperty, Telerik.WinControls.ValueResetFlags.Local);
        e.RowElement.ResetValue(LightVisualElement.DrawFillProperty, Telerik.WinControls.ValueResetFlags.Local);
 
    }
}

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga

Telerik WinForms MVP
0
Teng Mua
Top achievements
Rank 1
answered on 29 Apr 2011, 05:47 PM
Thank you, it worked perfectly.
0
Emanuel Varga
Top achievements
Rank 1
answered on 29 Apr 2011, 05:49 PM

Glad to be able to help,

If you have any more questions please just let me know, and if the question has been solved, please mark the question as answered, so that others can find the answers to their questions faster.

Best Regards,
Emanuel Varga


WinForms MVP
Tags
GridView
Asked by
Teng Mua
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Teng Mua
Top achievements
Rank 1
Share this question
or