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

Row ReadOnly State

1 Answer 71 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Konrad Sikorski
Top achievements
Rank 1
Konrad Sikorski asked on 19 Apr 2011, 04:23 PM

Hi,

I am using IsReadOnlyBinding property do disable some rows in my grid. Unfortunatly such read only row can by deleted by pressing "delete" keyboard button. I don't understand why, maybe there is some secret logic ;) 

So I would like to 'fix' this logic by myself. Unfortunately (second time) I cannot find any ReadOnly property for row which help me cancel Deleting event.

So I do not have a choice and I have to duplicate my ReadOnly logic once in xaml for IsReadOnlyBinding property and second in Deleting event.

By the way, why I cannot modified  Items property in GridViewAddingNewEventArgs? I could remove read only rows and continue the event.

Thank you for any help.

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 21 Apr 2011, 10:04 AM
Hello Konrad,

Indeed, you are quite correct - the expected behavior should be that if a row is read-only, it cannot be deleted. We will investigate the issue and improve the functionality as soon as possible. For the time being you may try to handle the Deleting event and cancel it for those rows that are not editable:

XAML:
<telerik:RadGridView Name="clubsGrid"                      
        IsReadOnlyBinding="{Binding IsActive}">
 
C#:
private void clubsGrid_Deleting(object sender, GridViewDeletingEventArgs e)
        {
            if((this.clubsGrid.SelectedItem as Club).IsActive == true)
            {
                e.Cancel = true;
            }
        }
                            
 
In this case IsActive is property of the business object - Club on which the read-only state depends.

 

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
Konrad Sikorski
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or