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

Display.Order conflict

5 Answers 167 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Adiel
Top achievements
Rank 2
Adiel asked on 08 Apr 2010, 10:02 AM
Hi
I mark some properties with Display.Order attribute.
When I'm using AutoGenerateColumns=false and set the column in my prefered order I got an excaption and the application crashe.
It big issue because it prevent me to use costom filter controls, or every column specific feature.
The controles ver is: RadControls_for_Silverlight4_RC_DEV


Error:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; .NET4.0C; .NET4.0E)
Timestamp: Thu, 8 Apr 2010 09:00:46 UTC

Message: Unhandled Error in Silverlight Application GridViewDataControl_DuplicateDisplayIndex   at Telerik.Windows.Controls.GridViewColumnCollectionInternal.InitializeDisplayIndexMap()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.InitializeDisplayIndex()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.RefreshColumns()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnItemsPropertyChanged(Object sender, PropertyChangedEventArgs e)
   at Telerik.Windows.Data.DataItemCollection.RaisePropertyChanged(PropertyChangedEventArgs args)
   at Telerik.Windows.Data.DataItemCollection.set_CollectionView(QueryableCollectionView value)
   at Telerik.Windows.Data.DataItemCollection.CreateCollectionView(IEnumerable source)
   at Telerik.Windows.Data.DataItemCollection.SetItemsSource(IEnumerable source)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.<>c__DisplayClass45.<Bind>b__44()
   at Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(FrameworkElement frameworkElement, Action action)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.Bind(Object newValue)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnEmptySourceCollectionViewCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Windows.Controls.DomainDataSourceView.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Windows.Controls.DomainDataSourceView.OnCollectionViewCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Windows.Controls.EntityCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
   at System.Windows.Controls.PagedEntityCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
   at System.Windows.Controls.PagedEntityCollectionView.CompletePageMove(Int32 pageIndex)
   at System.Windows.Controls.PagedEntityCollectionView.<.ctor>b__0(Object sender, EventArgs args)
   at System.Windows.Controls.PagedEntityCollection.NotifyPageChanged(Int32 startPageIndex, Int32 pageIndex)
   at System.Windows.Controls.DomainDataSource.DomainContext_Loaded(LoadedDataEventArgs e, LoadContext loadContext)
   at System.Windows.Controls.DomainDataSource.LoadData_Callback(LoadOperation loadOperation)
   at System.ServiceModel.DomainServices.Client.LoadOperation.<>c__DisplayClass4`1.<Create>b__0(LoadOperation`1 arg)
   at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
   at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Object result)
   at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(DomainClientResult result)
   at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
   at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )
Line: 1
Char: 1
Code: 0

Message: Unhandled Error in Silverlight Application
Code: 4004   
Category: ManagedRuntimeError      
Message: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at Telerik.Windows.Controls.GridViewColumnCollectionInternal.ColumnFromDisplayIndex(Int32 displayIndex)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.ColumnFromDisplayIndex(Int32 displayIndex)
   at Telerik.Windows.Controls.GridView.GridViewCellsPanel.DetermineRealizedColumnsBlockList(Size constraint)
   at Telerik.Windows.Controls.GridView.GridViewCellsPanel.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)    

Line: 56
Char: 13
Code: 0

 

5 Answers, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 09 Apr 2010, 05:05 PM
Hi Adiel,

The exception states that you have duplicate column display indexes. Can you double check that you are setting not duplicate order properties in the attributes and also your order is starting from 0.

Regarding your other question you can use the AutoGeneratingColumn event of the grid to set properties on the auto-generated columns.

Greetings,
Stefan Dobrev
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
Adiel
Top achievements
Rank 2
answered on 11 Apr 2010, 08:17 AM
Hi
I've check this.
The exception occur when I'm adding the index attribute to properties.
If I don't mark any property with index it work perfectly.
If I mark any of them the exception occur.
Thanks
Adiel
0
Stefan Dobrev
Telerik team
answered on 12 Apr 2010, 07:05 AM
Hi Adiel,

Can you send us a small sample application which illustrates how you are setting the attributes? This will greatly help us to provide you with a solution to this problem.

Sincerely yours,
Stefan Dobrev
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
Tim
Top achievements
Rank 1
answered on 22 Dec 2011, 05:31 AM
Not sure if this has been resolved or not, but I am having the same error (2011.3 release).  Basically, if you attempt to set the "DisplayOrder" property of a Column you are manually adding in code-behind, the Grid crashes with an "Unhandled Exception" (index out of range).  I have verified that all my Display Orders are in fact unique and start from "0".  The only way around this is to make absolutely sure you add the columns in the order you expect them and DO NOT specify a "DisplayOrder" for them.
0
Vlad
Telerik team
answered on 22 Dec 2011, 08:23 AM
Hi,

 Please use our just released service pack (Q3 2011 SP1) to avoid this. 

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Adiel
Top achievements
Rank 2
Answers by
Stefan Dobrev
Telerik team
Adiel
Top achievements
Rank 2
Tim
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or