Enable selection in readonly textbox grid cell

2 posts, 0 answers
  1. Mydatafactory
    Mydatafactory avatar
    68 posts
    Member since:
    Feb 2008

    Posted 14 Nov 2016 Link to this post

    Is there a way to enable selection in a readonly textbox grid cell? So a user cannot edit the text but can select part of the text?
  2. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    4086 posts

    Posted 14 Nov 2016 Link to this post

    Hello Jeroen,

    Thank you for writing.  

    Read-only columns are not supposed to enter edit mode. However, note that you can set the ReadOnly property of the column to false, but make the editor read-only. Thus, you will be allowed to enter edit mode and select part of the text. Here is a sample code snippet: 
    public RadForm1()
        this.radGridView1.Columns["ProductName"].ReadOnly = false;
        this.radGridView1.CellEditorInitialized += radGridView1_CellEditorInitialized;
    private void radGridView1_CellEditorInitialized(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
        RadTextBoxEditor tb = e.ActiveEditor as RadTextBoxEditor;
        if (tb != null && this.radGridView1.CurrentColumn.Name == "ProductName")
            RadTextBoxEditorElement el = tb.EditorElement as RadTextBoxEditorElement;
            el.TextBoxItem.ReadOnly = true;

    I hope this information helps. Should you have further questions I would be glad to help.

    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Back to Top