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

2 posts, 1 answers
  1. Anu
    Anu avatar
    8 posts
    Member since:
    May 2011

    Posted 23 Sep 2011 Link to this post

    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 );




  2. Answer
    Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 28 Sep 2011 Link to this post

    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 >>

Back to Top