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

How to show GridviewCheckBoxColumn- CheckBox column without a box around it (just the tick or empty) ?

1 Answer 144 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anu
Top achievements
Rank 1
Anu asked on 23 Sep 2011, 04:48 PM
I want to show a CheckBox column without a box around it (just the tick or empty). But i am not sure how to style this. My GridviewCheckBoxColumn is readonly in this case so i want to just show a Tick mark when the file is true otherwise leave blank. Here is the code where i add the column to radgridview:
Please help
Thanks
GridViewCheckBoxColumn colIsActive = new GridViewCheckBoxColumn("IsActive");
 colIsActive .Width = 50;
 colIsActive .HeaderText = "Active";
 colIsActive .ReadOnly = true;
 colIsActive .WrapText = true;
 //colIsActive .style???= no box around ???
 _radGV.MasterTemplate.Columns.Add(colIsActive );




1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 28 Sep 2011, 12:30 PM
Hello Anu,

Thank you for writing.

You can use the ViewCellFormatting event in order to access the RadCheckBoxCellElement and hide the desired Border and Fill primitives. Here is an example:
void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    GridCheckBoxCellElement checkBoxCell = e.CellElement as GridCheckBoxCellElement;
    if (checkBoxCell != null)
    {
        RadCheckBoxEditor editor = checkBoxCell.Editor as RadCheckBoxEditor;
        RadCheckBoxEditorElement element = editor.EditorElement as RadCheckBoxEditorElement;
        element.Checkmark.Border.Visibility = ElementVisibility.Collapsed;
        element.Checkmark.Fill.Visibility = ElementVisibility.Collapsed;
    }
}

I hope that you find this information helpful. If there is anything else we can assist you with, do not hesitate to contact us.
 
Best wishes,
Stefan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Anu
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or