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

[Solved] How to Flush the GridView properly?

2 Answers 111 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jitin
Top achievements
Rank 1
Jitin asked on 24 Aug 2009, 09:52 PM
Hi,

In my application, I am having to load the same instance of grid with different data sets at different times. I try to flush out the grid every time I load new dataset. Still, I am seeing exceptions when I load the grid the second or third time or later. The exceptions indicates that the grid is somehow still attached to its old dataset. This usually happens when a user applies filter or column sorting and then go on to load another dataset. Here is code that I use to flush the grid completely before loading new data.

Do I need to add something here or follow different approach?

      this.radTargetGridNodes.SelectedItem = null;
      this.radTargetGridNodes.FilterDescriptors.Clear();
      this.radTargetGridNodes.FieldDescriptors.Clear();
      this.radTargetGridNodes.Columns.Clear();
      this.radTargetGridNodes.GroupDescriptors.Clear();
      this.radTargetGridNodes.TableDefinition.ChildTableDefinitions.Clear();
      this.radTargetGridNodes.Records.Clear();
      this.radTargetGridNodes.ItemsSource = null;

Thanks,
Jitin


2 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 25 Aug 2009, 01:51 PM
Hi Jitin,

It seems you have hit a bug in RadGridView . It is definitely not normal for RadGridView to throw exceptions when changing the ItemsSource. Can you please help us resemble the problem here. As soon as we can reproduce the behavior here we will  try to provide a fix. Some code  or a sample project demonstrating how the exception occurs would be of great help for us .


Regards,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jitin
Top achievements
Rank 1
answered on 31 Aug 2009, 04:17 PM
Hi Pavel,

My current solution is in a very disconnected format. Everything is driven by web services from various sources. I will have to create another project with mocked-up data for you. I will attach it in this post later.

Thanks,
Jitin
Tags
GridView
Asked by
Jitin
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Jitin
Top achievements
Rank 1
Share this question
or