Display.Order conflict

6 posts, 0 answers
  1. Adiel
    Adiel avatar
    60 posts
    Member since:
    Jun 2012

    Posted 08 Apr 2010 Link to this post

    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

     

  2. Stefan Dobrev
    Admin
    Stefan Dobrev avatar
    790 posts

    Posted 09 Apr 2010 Link to this post

    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.
  3. DevCraft banner
  4. Adiel
    Adiel avatar
    60 posts
    Member since:
    Jun 2012

    Posted 11 Apr 2010 Link to this post

    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
  5. Stefan Dobrev
    Admin
    Stefan Dobrev avatar
    790 posts

    Posted 12 Apr 2010 Link to this post

    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.
  6. Tim
    Tim avatar
    85 posts
    Member since:
    Aug 2008

    Posted 21 Dec 2011 Link to this post

    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.
  7. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 22 Dec 2011 Link to this post

    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 >>

Back to Top
DevCraft banner