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

RadGridVIew Index was outside the bounds of the array.

15 Answers 261 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Paulius Putna
Top achievements
Rank 1
Paulius Putna asked on 26 Mar 2011, 04:57 PM
I was using this blog post example, the one in the comments with updated silverlight, in my project and I kept getting this exception:

Index was outside the bounds of the array.
   at Telerik.Windows.Controls.GridView.IndexTree.Set(Int32 index, Double value)
   at Telerik.Windows.Controls.GridView.IndexTree.set_Item(Int32 index, Double value)
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)


I then started fiddling with the sample project supplied and was looking for differences between the projects. I then noticed if you set AutoGenerateColumns to false and supply a column templates it throws this exception. In other cases it works fine and as expected. I would attach a sample project with this error reproduced, but only picture files are allowed so I uploaded it to mediafire and here is the link. Please help me out, because this is closely related to my paging problems I described in this post.

15 Answers, 1 is accepted

Sort by
0
Paulius Putna
Top achievements
Rank 1
answered on 28 Mar 2011, 02:37 AM
So I've been working with the project through weekend and I noticed that it doesn't matter if you set any custom defined columns, the exception is thrown only when AutogenerateColumns is set to False.
0
Mike
Top achievements
Rank 1
answered on 29 Mar 2011, 12:47 PM
We have been able to confirm that this error only started occurring in our code after we applied the latest 2011 internal build. Previously we were on 2010.

We don't have time to create a sample project, and will live with the error, but will look in to it further in the next few weeks. I guess I'm hoping you might resolve it first :)

Will keep an eye on this thread, fingers crossed.
0
Mike
Top achievements
Rank 1
answered on 29 Mar 2011, 12:55 PM
Its just clicked, I followed that blog when writing our code as well. Explains why were both broken.
0
Mike
Top achievements
Rank 1
answered on 29 Mar 2011, 01:08 PM
It works if you dont override "TotalItemCount" in the implementation of "QueryableCollectionView". I'm not sure yet if there are repercussions to the server side functionality by doing this.
0
Ivan Ivanov
Telerik team
answered on 29 Mar 2011, 01:47 PM
Hi,

I'm attaching a project with the latest version of this approach. 

All the best,
Ivan Ivanov
the Telerik team
0
Mike
Top achievements
Rank 1
answered on 29 Mar 2011, 02:42 PM
Thanks for the quick response, our code is different to the blog and closer to the new sample but we still get the error. If the blog code now works for everyone we will investigate our code further.

Thanks again
0
Paulius Putna
Top achievements
Rank 1
answered on 29 Mar 2011, 08:27 PM
All you have to do is convert the project to 2011 Q1 telerik binaries and you get the exception.
0
Milan
Telerik team
answered on 31 Mar 2011, 05:59 PM

Hello Paulius Putna,

We have identified the issue and we will be fixing it as soon as possible. I will notify you when the issue is fixed.

Your Telerik points have been updated. 



Regards,
Milan
the Telerik team
0
Bryan Hill
Top achievements
Rank 1
answered on 21 Apr 2011, 03:28 PM
Bump. Just upgraded and I am having the same issue.  
0
Bryan Hill
Top achievements
Rank 1
answered on 21 Apr 2011, 04:24 PM
Found a work around in my override for the QueryableCollectionView!  The important part is to keep the base property synced with your override property.
private int itemCount;
 
public void SetTotalItemsCount(int count)
{
    TotalItemCount = count;
 
    OnPropertyChanged(new PropertyChangedEventArgs("ItemCount"));
    OnPropertyChanged(new PropertyChangedEventArgs("TotalItemCount"));
}
 
public override int TotalItemCount
{
    get
    {
        return itemCount;
    }
    protected set
    {
        itemCount = value;
        base.TotalItemCount = value;
    }
}
0
Bryan Hill
Top achievements
Rank 1
answered on 21 Apr 2011, 06:57 PM
Ok I think I got it now.  Only use the method SetTotalItemsCount from your code to set the totals.

private int itemCount;
 
public void SetTotalItemsCount(int count)
{
    itemCount = count;
    base.TotalItemCount = count;
     
    OnPropertyChanged(new PropertyChangedEventArgs("ItemCount"));
    OnPropertyChanged(new PropertyChangedEventArgs("TotalItemCount"));
}       
 
public override int TotalItemCount
{
    get
    {
        return itemCount;
    }
    protected set
    {
        //base.TotalItemCount = value;
    }
}
 
public override int ItemCount
{
    get
    {
        return itemCount;
    }
}
0
Bryan Hill
Top achievements
Rank 1
answered on 13 May 2011, 05:19 PM
I cannot find any bug in the Issue Tracker for this bug.  When is this getting fixed?  
0
Bryan Hill
Top achievements
Rank 1
answered on 08 Jun 2011, 06:27 PM
Still waiting for a reply.  When will this get fixed?  Cannot find in "Issue Tracker".
0
Yordanka
Telerik team
answered on 09 Jun 2011, 03:29 PM
Hi Bryan Hill,

We have modified DescriptorsExtensions.cs and MyDataContext.cs files of the application attached above so that to fit in the current version of the RadGridView. Please, find it in the attached file. It is working fine with Q1 2011 SP1 binaries.

Let us know if you have additional questions.
 
Best wishes,
Yordanka
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
0
Kristof
Top achievements
Rank 1
answered on 15 Jul 2011, 12:14 PM
I have the same issue when using the QueryableDomainServiceCollectionView<T>.
After the QDSCV is created, I set the Parameters collection to the updated values, when refreshing the QDSCV.
When I receive data there is no problem, when I receive once an empty result and try to trigger a new query that returns result. I get the following error:

Index was outside the bounds of the array.
 
   at Telerik.Windows.Controls.GridView.IndexTree.Set(Int32 index, Double value)
   at Telerik.Windows.Controls.GridView.IndexTree.set_Item(Int32 index, Double value)
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)

Also if I add similar changes to the myQDSCV it directly throws the exception above.
Tags
GridView
Asked by
Paulius Putna
Top achievements
Rank 1
Answers by
Paulius Putna
Top achievements
Rank 1
Mike
Top achievements
Rank 1
Ivan Ivanov
Telerik team
Milan
Telerik team
Bryan Hill
Top achievements
Rank 1
Yordanka
Telerik team
Kristof
Top achievements
Rank 1
Share this question
or