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

Delete Row from Child Table

3 Answers 106 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Richard Harrigan
Top achievements
Rank 1
Richard Harrigan asked on 07 Jul 2010, 09:35 PM
Hi,

I am using the following code to Delete a row from  the RadGridView. This works for the first level in the hiarchy.  However, on the second level the SelectedItem == null. 

==================================

this

 

 

.AddHandler(UIElement.KeyDownEvent, new KeyEventHandler(MouseDownOnCell), true);

 

private

 

 

void MouseDownOnCell(object sender, KeyEventArgs args)

 

 

  

 

    if

 

 

(args.Key == Key.Delete && this.RadGridView1.SelectedItem != null)

 

    {

 

 

        MyDataContext.DomainContext.Customers.Remove(RadGridView1.SelectedItem as Customer);

 

    }

 

 

 

 

 

}

 

========================================

3 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 13 Jul 2010, 07:54 AM
Hi Richard Harrigan,

RadGridView has a built-in support for record deletion - when the Delete key is pressed all selected items will be deleted. Depending on your scenario this functionality might not work - if the hierarchy items are items that are retrieved using an Ria Services associations the built-in functionality will not work since the list of associations does not support remove operations ( it is not IList).

Fortunately one of my colleagues has created a sample where with a little bit of tweaking the deleted operation is enabled for child grids as well.

Could you please take a look at the attached sample and determine if the proposed solution can be used in your scenario.


Sincerely yours,
Milan
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
Richard Harrigan
Top achievements
Rank 1
answered on 13 Jul 2010, 09:45 PM
Hi Milan,

I'm sorry but I could't get it to compile.  Is it possible that you point out the specific changes made to enable delete and insert child row from the Insert and Delete keys.

Thanks
Rich
0
Milan
Telerik team
answered on 14 Jul 2010, 02:43 PM
Hi Richard Harrigan,

Unfortunately the changes are not trivial. Could you please paste some of errors? 


Greetings,
Milan
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
Richard Harrigan
Top achievements
Rank 1
Answers by
Milan
Telerik team
Richard Harrigan
Top achievements
Rank 1
Share this question
or