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

"ReadOnly" grid with AddNew

1 Answer 114 Views
GridView
This is a migrated thread and some comments may be shown as answers.
joe castle
Top achievements
Rank 1
joe castle asked on 21 Jun 2010, 07:58 PM
Hi,

I would like to have a "ReadOnly" grid, meaning that I can select, add new (enabled ShowInsertRow) and delete rows but I should not be able to edit cells. If I just set the IsReadOnly = true it locks the whole grid.

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 23 Jun 2010, 06:05 PM
Hello,

You can subscribe to the BeginningEdit event  as shown below:

private void RadGridView1_BeginningEdit(object sender, GridViewBeginningEditRoutedEventArgs e)
        {
            if (this.RadGridView1.Items.CurrentAddItem != e.Row.Item)
            {
                e.Cancel = true;
                return;
            }
        }

This will ensure that you can edit only if a new item is added. In all the other case, editing will be canceled.
Furthermore, when defining the event this way, both selection and deletion are possible.


Best wishes,
Maya
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
joe castle
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or