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

[Solved] GroupDescriptors.Clear() throwing a NullReferenceException

1 Answer 72 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.
Teddy Stotis
Top achievements
Rank 1
Teddy Stotis asked on 08 Sep 2010, 06:19 PM
Whenever the content of my grid changes, it seems like I always have to reapply the group descriptors, which is fine, but in the following code snippet where the groups are reset, the GroupDescriptors.Clear() call returns a NullReferenceException probably around 1 out of every 5 times.

public void SetGroups()
{
    GroupDescriptor groups = new GroupDescriptor();
    groups.Member = "AccountData.Name";
    groups.SortDirection = ListSortDirection.Ascending;
    if (gvOrdersAlerts.GroupDescriptors != null &&
        gvOrdersAlerts.GroupDescriptors.Count > 0)
        gvOrdersAlerts.GroupDescriptors.Clear();
    gvOrdersAlerts.GroupDescriptors.Add(groups);
}

After the exception, the grid behaves weird until this code is run again.  Any ideas as to why this is happening?

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 09 Sep 2010, 06:16 AM
Hello Teddy Stotis,

This is strange. What is the exact version you are using?
Can you reproduce the problem in a simple project?

Sincerely yours,
Veselin Vasilev
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
Teddy Stotis
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or