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

RadGridView disable updating rows

3 Answers 146 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 18 Oct 2011, 07:20 PM
Hello,

    I have a RadGridView bound to a collection and i'd like to disable updating of existing rows.  I still need to be able to use the insert functionality of the grid to add new rows, but I do not want rows in the grid to be updated.  Is this possible?

Using Silverlight, latest Telerik tools

Thanks!

3 Answers, 1 is accepted

Sort by
0
Matt
Top achievements
Rank 1
answered on 18 Oct 2011, 07:55 PM
Best way I could find to do this was to check and see if the database created identity key was filled in

 

 

if ((e.Row.DataContext as DataBoundObject).ID > 0)
{
    e.Cancel = true;
}

0
Maya
Telerik team
answered on 19 Oct 2011, 08:17 AM
Hello Matt,

Would you take a look at this forum thread ? Will the approach suggested there correspond to your needs ?
 

Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Matt
Top achievements
Rank 1
answered on 19 Oct 2011, 01:28 PM
Thank you, that was very helpful!

I only ran into an issue when attempting to use the same code on a gridview in the details of my main gridview, so I came up with the following which works in both

if ((sender as Telerik.Windows.Controls.RadGridView).Items.CurrentAddItem != e.Row.Item)
{
    e.Cancel = true;
}

Tags
GridView
Asked by
Matt
Top achievements
Rank 1
Answers by
Matt
Top achievements
Rank 1
Maya
Telerik team
Share this question
or