Changing back color of GridTextBoxColumn while editing in RadGridView control

2 posts, 0 answers
  1. Cheryl
    Cheryl avatar
    2 posts
    Member since:
    Mar 2013

    Posted 28 May 2015 Link to this post


    I need to change  back color of GridTextBoxColumn while editing in RadGridView control.

    My application have two themes BLACK and WHITE.

    For BLACK theme textcolor is white editing GridTextBoxColumn  the backcolor is white and textcolor is same so I'm unable see the typed text.

    So far I have tried below approach

     GridViewDataRowInfo row = new GridViewDataRowInfo(this.dataGridView1.MasterView);
                    row.Cells[0].Value = "";
                    row.Cells[1].Value = "";
                    row.Cells[0].Style.CustomizeFill = true;
                    row.Cells[0].Style.DrawFill = true;
                    row.Cells[0].Style.BackColor = ColorTranslator.FromHtml("41,44,41");



    row.Cells[0] is GridTextBoxColumn

    row.Cells[1] is GridCommandColumn 

    but the changes are not affecting white editing text.

    Please help.


    Thanks in advance.


  2. Todor Vyagov
    Todor Vyagov avatar
    31 posts

    Posted 29 May 2015 Link to this post

    Hello Cheryl,

    Thank you for writing.

    To change the background color of cell in edit mode you can subscribe to RadGridView's CellEditorInitialized event and set the BackColor of RadTextBoxEditor's RadTextBoxItem and FillPrimitive children.
    void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
        RadTextBoxEditor editor = e.ActiveEditor as RadTextBoxEditor;
        if (editor != null)
            (editor.EditorElement.Children[0] as RadTextBoxItem).BackColor = Color.FromArgb(41, 44, 41);
            (editor.EditorElement.Children[1] as FillPrimitive).BackColor = Color.FromArgb(41, 44, 41);

    I hope this information helps.

    Todor Vyagov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top