how to remove row from childgrid

5 posts, 0 answers
  1. Ravi
    Ravi avatar
    104 posts
    Member since:
    Oct 2012

    Posted 15 Apr 2011 Link to this post

    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.
  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 15 Apr 2011 Link to this post

    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
  3. DevCraft banner
  4. Ravi
    Ravi avatar
    104 posts
    Member since:
    Oct 2012

    Posted 15 Apr 2011 Link to this post

    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
  5. Ravi
    Ravi avatar
    104 posts
    Member since:
    Oct 2012

    Posted 18 Apr 2011 Link to this post

    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
  6. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 18 Apr 2011 Link to this post

    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
Back to Top
DevCraft banner