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

Why are GridGroupHeaderItem item indexes increased by 2 and not numerically sequential?

1 Answer 25 Views
Grid
This is a migrated thread and some comments may be shown as answers.
pmourfield
Top achievements
Rank 1
pmourfield asked on 25 Jul 2012, 02:14 PM
The following code iterates through all of the groupheaderitems in my RadGrid. I was originally having trouble expanding groups programmatically because I was attempting to expand based on sequential item.groupindex indexes, e.g. if (item.groupindex == "0" || item.groupindex == "1".

However, I found that the groupindex == "1" wasn't working so I wrote the following method to append all of the indexes to a stringbuilder:

protected void WeeklyGoalsGrid_PreRender(object sender, EventArgs e)
       {
           StringBuilder sb = new StringBuilder();
           foreach (GridGroupHeaderItem item in WeeklyGoalsGrid.MasterTableView.GetItems(GridItemType.GroupHeader))
           {
               sb.Append(item.GroupIndex);
           }           
       }

When I run the application, the stringbuilder contains {02468} and so on rather than what I thought should be {01234}

Does anyone know why the GroupHeaderItem indexes increase by two rather than by 1? This doesn't affect my code, as now I know what to look for, but I was just wondering about the reasoning behind this.

Thanks,

Josh

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 30 Jul 2012, 08:28 AM
Hi,

I tried to replicate the issue by creating a sample project, but everything works as expected on my side. Could you give the project a try and let me know if I am missing something.

All the best,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
pmourfield
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or