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

Cell Enabled Bug

1 Answer 103 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 14 Sep 2007, 02:09 AM
I'm using the Command:

e.CellElement.Enabled = False

Now this appears to work at first, in that I can't click into the cell, But if I click on the cell next to it which is enabled, and use the arror key to move into the disabled cell, I can then Type directly into it, and it will allow this me to do that.
Should this be happening?
Is there another way to may an individual cell disabled? (ie read only)

1 Answer, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 14 Sep 2007, 10:42 AM
Hello Tony,

The CellElement is part of the visual structure of RadGridView and as such it might be destroyed or filled with different data when scrolling or performing other actions, meaning that you cannot rely on state persistence.

A solution of the problem is to subscribe to the CellBeginEdit event and cancel it:
 
private void Form1_Load(object sender, EventArgs e) 
    radGridView1.CellBeginEdit += new GridViewCellCancelEventHandler(radGridView1_CellBeginEdit); 
 
private void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e) 
    GridCellBoundColumnElement cell = sender as GridCellBoundColumnElement; 
 
    if ( /* this cell should not be edited */ ) 
        e.Cancel = true
 


 
Regards,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Tony
Top achievements
Rank 1
Answers by
Dwight
Telerik team
Share this question
or