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

how to remove row from childgrid

4 Answers 94 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ravi
Top achievements
Rank 1
Ravi asked on 15 Apr 2011, 12:27 PM
Hi,

I have a hierachygrid implemented, in the childgrid i have four columns, the last column I have provided a button, upon clicking the button the user will be prompted with a messagebox. if the user click OK in the message box the row should get deleted. how can i achieve this functionality?

Three things required

1) upon the click of the delete button the row should get selected
2) upon clicking the messagebox button (Ok), the row should be deleted from childgrid. I have implemented the messagebox. now upon clicking it should delete the row from the childgrid?
3) is there any MessageBox wiht YES and NO button in telerik package?

Please advice.

4 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 15 Apr 2011, 12:58 PM
Hi David,

 

The better option here is to define a HierarchyChild template for your RadGridView and within the inline RadGridView to integrate your custom logic. You may expose a SelectedItem property of the ViewModel, which you can pass as a CommandParameter to the Button in each row, as described here. In order to display a confirmation window before deleting an item, follow the approach demonstrated in the following online help article. 



Please let me know if you need any further assistance.


All the best,
Vanya Pavlova
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
Ravi
Top achievements
Rank 1
answered on 15 Apr 2011, 01:57 PM
please suggest if there is anyway, user selecting the row and then selecting the delete button will not be acceptable by the client. the requirement is when the user clicks on the button the row should be selected and the user should get a messagebox. in the message box the user clicks on OK button and the row gets removed from the child grid. please suggest an alternative.


Thanks
Shiras
0
Ravi
Top achievements
Rank 1
answered on 18 Apr 2011, 05:08 AM
I would appreciate if you could send me a solution to this. I have even worked on ComponentArt and I remember it was so easy to get access to the childgrid and make the row as selected in the childgrid.

Please let me know the workaround for this as this is already due.

Appreciate your early response.

Thanks,
Shiras
0
Vanya Pavlova
Telerik team
answered on 18 Apr 2011, 09:30 AM
Hi David,

 
I am a bit confused here! In such a scenario the approaches are different, based on your custom needs. 
If you just need to select a row on button click you may use the following snippet of code:

private void Button_Click(object sender, RoutedEventArgs e)
{
    var senderElement = e.OriginalSource as FrameworkElement;
    var row = senderElement.ParentOfType<GridViewRow>();
   
    if (row != null)
        row.IsSelected = true;
}

However I am not quite sure how it corresponds in your custom scenario, you may read more about this here. Furthermore I believe that the most interesting part in your case is how to delete a row only from the child grids. The following forum thread will give you the information you need, please follow this link.



All the best,
Vanya Pavlova
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
Ravi
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Ravi
Top achievements
Rank 1
Share this question
or