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

Clearing a hierarchical content

3 Answers 59 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michele
Top achievements
Rank 2
Michele asked on 27 Mar 2014, 04:13 PM
Hello,
I'm using MVVM pattern and a behavior to load hierarchical data from a radgridview... at the main row expansion I call a webservice to fetch data, after some operation I need to reload the inner gridview..... I don't know how to clean the content just loaded since if I do a

  parentGrid.IsExpanded = false;
  parentGrid.IsExpanded = true;

it doesn't make the call since it has the data already loaded...
Thanks in advance

Paolo

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 27 Mar 2014, 04:43 PM
Hi,

You can try rebinding RadGridView. How does this work for you?

Regards,
Didie
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
Michele
Top achievements
Rank 2
answered on 28 Mar 2014, 07:16 AM
hello,
no I can't since it will do a full grid reload...and I wish just to update the inner grid content....I've also tried with

​parentRow.InvalidateVisual but it doesn't work.... the problem is that my inner grid is filled in async calling a stored procedure...(using a behavior)

public class ControlloSquadratureBehavior : Behavior<RadGridView>
    {
        protected override void OnAttached()
        {
            base.OnAttached();
            AssociatedObject.LayoutUpdated += AssociatedObject_LayoutUpdated;
        }
 
        private void AssociatedObject_LayoutUpdated(object sender, EventArgs e)
        {
            AssociatedObject.LayoutUpdated -= AssociatedObject_LayoutUpdated;
 
            var childGridcontext = AssociatedObject.DataContext as IF_SP_DTR_VERIFICA_TITOLI_Result;
 
            if (childGridcontext != null)
            {
                var context = AssociatedObject.ParentOfType<UserControl>().DataContext as ControlloSquadratureViewModel;
 
                if (childGridcontext.GetType() == typeof(IF_SP_DTR_VERIFICA_TITOLI_Result))
                {
                    context.GetDetailBySpecificParentValue(childGridcontext, items =>
                        {
                            AssociatedObject.ItemsSource = items;
                        }
                        );
                }
            }
        }

I wish to keep the normal flow...
0
Dimitrina
Telerik team
answered on 28 Mar 2014, 11:34 AM
Hello,

As you do not need to re-fill all the child grids, you can then get an instance of a particular inner grid you are interested in and invoke a Rebind() on it. This will update its content.

Regards,
Didie
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
GridView
Asked by
Michele
Top achievements
Rank 2
Answers by
Dimitrina
Telerik team
Michele
Top achievements
Rank 2
Share this question
or