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

RadGridView GridViewCheckBoxColumn filter cell

3 Answers 139 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 27 Jan 2009, 12:23 AM
How can I access the filter cell in a GridViewCheckBoxColomn?  Specifically, I'd like to change the little box that displays where the RadCheckBox editor will be when it gets activated.  I'm finding that the box does not always draw itself in the same way, especially if you add a GridViewCheckBoxColumn to an empty grid.

Thanks in advance,
Kevin

3 Answers, 1 is accepted

Sort by
0
Accepted
Jack
Telerik team
answered on 27 Jan 2009, 01:33 PM
Hello Kevin,

Thank you for this question.

You can access the filter cell when processing the ViewCellFormatting event. You can check the header text and take the first child element in order to get the RadCheckBoxEditor inside. Here is an example:

void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e) 
    if (e.CellElement is GridFilterCellElement && e.CellElement.ColumnInfo.HeaderText == "Option3"
    { 
        RadCheckBoxEditor checkbox = e.CellElement.Children[0] as RadCheckBoxEditor; 
        if (checkbox != null
        { 
            ((FillPrimitive)checkbox.Children[0]).BackColor = Color.Red; 
            ((FillPrimitive)checkbox.Children[0]).GradientStyle = GradientStyles.Solid; 
        } 
    } 

Another approach is to load the grid in Visual Style Builder and create a new theme. More about the Visual Style Builder can be found on telerik tv.

I hope this helps. Do not hesitate to write me back if you have other questions.

All the best,
Jack
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Kevin
Top achievements
Rank 1
answered on 27 Jan 2009, 07:49 PM

Very cool!  That worked perfectly.  Just for future reference, here is how I modified your code to fix my particular problem.

 

 

void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)

 

{

 

    if (e.CellElement is GridFilterCellElement && e.CellElement.ColumnInfo is GridViewCheckBoxColumn)

 

    {

 

        RadCheckBoxEditor checkbox = e.CellElement.Children[0] as RadCheckBoxEditor;

 

 

        if (checkbox != null)

 

        {

            ((

BorderPrimitive) checkbox.Children[1]).GradientStyle = GradientStyles.Solid;

 

        }

     }

}

We have tried using themes to control this, but this is a situation where I want to override all themes with a consistent appearance.

 

0
Jack
Telerik team
answered on 28 Jan 2009, 03:00 PM
Hi Kevin,

I am glad to hear that you have solved this issue - thank you for sharing your solution with us. Please do not hesitate to contact us if you have other questions.

Regards,
Jack
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Kevin
Top achievements
Rank 1
Answers by
Jack
Telerik team
Kevin
Top achievements
Rank 1
Share this question
or