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

How to have a grid that isn't editable but where we can insert NEW element?

3 Answers 39 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Julien
Top achievements
Rank 1
Julien asked on 16 Aug 2010, 08:29 AM
Hi!

For a project I've to have a list where we can insert new element but never delete/edit previous elements.

Have you an idea about how to do this with the RadGridView?

Thank you :)

3 Answers, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 16 Aug 2010, 08:40 AM
Hello Julien,

In order to enable adding new items, while disabling editing existing ones, you can handle the BeginningEdit event of the grid like follows:

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

As for removing the "delete" functionality, you can handle the Deleting event of the grid and cancel it:
private void playersGrid_Deleting(object sender, GridViewDeletingEventArgs e)
{
    e.Cancel = true;
}
 


Sincerely yours,
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
0
Julien
Top achievements
Rank 1
answered on 16 Aug 2010, 09:17 AM
Thank you! Exactly what I was needing!
0
Nikolai Hellwig
Top achievements
Rank 1
answered on 29 Sep 2010, 12:25 PM
thanks a lot. this is exactly what i was looking for.
Tags
GridView
Asked by
Julien
Top achievements
Rank 1
Answers by
Maya
Telerik team
Julien
Top achievements
Rank 1
Nikolai Hellwig
Top achievements
Rank 1
Share this question
or