radGridView ReadOnly Columns Prevent BeginEdit

1 Answer 100 Views
GridView
Walker
Top achievements
Rank 1
Walker asked on 16 Nov 2022, 08:04 PM

I have a radGridView, bound to a datatable with certain columns marked as readonly. The problem is that for the readonly columns, the user can still attempt to edit the cell text/value and only upon leaving the cell are they presented with a message that appears as so.

My goal when clicking on the cell of a readonly column, BeginEdit would not fire (ie, the cursor would not enter the cell). I've tried creating several different events and checking if column is readonly and then cancelling the event but I seem to have no luck.

        private void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
        {
            if (e.Column.ReadOnly)
            {
                e.Cancel = true;
            }
        }

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 17 Nov 2022, 07:12 AM

Hi, Walker,

By default, if a column is marked as read-only (the column's ReadOnly property is set to true), the editor is not expected to be activated for it at all. That is why the CellBeginEdit wouldn't be fired as well. Are you still entering edit mode for a column that is read-only?

Could you please provide a sample code snippet for the grid's setup you are using demonstrating how the column is marked as read-only?  Once we replicate the undesired behavior locally, we would be able to make an adequate analysis of the precise case and provide further assistance. Thank you in advance for your cooperation.

I am looking forward to your reply.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
GridView
Asked by
Walker
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or