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

Invalid property or field - 'MyProperty' for type: Entity

2 Answers 113 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marco Barzaghi
Top achievements
Rank 1
Marco Barzaghi asked on 06 May 2010, 10:42 AM
Hi,

for some reason I have to change the PageSize of my DomainDataSource (using AutoLoad = false). When I change the property the RadGridView has some SortDescriptors assigned. The RadGridView is having binding with DomainDataSource.Data. Here the code to change the PageSize runtime.

                    myDomainDataSource.PageSize = 20;
                    myDomainDataSource.Load();

This is the exception I get: Invalid property or field - 'MyProperty' for type: Entity. "MyProperty" is one of the property assigned to one of SortDescriptors.

This is the stacktrace

   at Telerik.Windows.Data.Expressions.MemberAccessTokenExtensions.CreateMemberAccessExpression(IMemberAccessToken token, Expression instance)
   at Telerik.Windows.Data.Expressions.ExpressionFactory.MakeMemberAccess(Expression instance, String memberName)
   at Telerik.Windows.Data.Expressions.ExpressionFactory.MakeMemberAccess(Expression instance, String memberName, Boolean liftMemberAccessToNull)
   at Telerik.Windows.Data.Expressions.PropertyAccessExpressionBuilder.CreateMemberAccessExpressionOverride()
   at Telerik.Windows.Data.Expressions.MemberAccessExpressionBuilderBase.CreateMemberAccessExpression()
   at Telerik.Windows.Data.Expressions.MemberAccessExpressionBuilderBase.CreateLambdaExpression()
   at Telerik.Windows.Data.SortDescriptorCollectionExpressionBuilder.Sort()
   at Telerik.Windows.Data.SortDescriptorCollection.Sort(IQueryable queryable)
   at Telerik.Windows.Data.QueryableExtensions.Sort(IQueryable source, SortDescriptorCollection sortDescriptors)
   at Telerik.Windows.Data.QueryableCollectionView.CreateView()
   at Telerik.Windows.Data.QueryableCollectionView.get_QueryableView()
   at Telerik.Windows.Data.QueryableCollectionView.CreateInternalList()
   at Telerik.Windows.Data.QueryableCollectionView.EnsureInternalList()
   at Telerik.Windows.Data.QueryableCollectionView.get_InternalList()
   at Telerik.Windows.Data.QueryableCollectionView.InternalIndexOf(Object item)
   at Telerik.Windows.Data.QueryableCollectionView.IndexOf(Object item)
   at Telerik.Windows.Data.QueryableCollectionView.MoveCurrentTo(Object item)
   at Telerik.Windows.Data.Selection.SelectionHandler.SyncCurrentWithSelected()
   at Telerik.Windows.Data.Selection.SelectionHandler.TrySyncCurrentWithSelected()
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnItemsChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Controls.GridView.BaseItemsControl.OnItemCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.DataItemCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.DataItemCollection.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at Telerik.Windows.Data.QueryableCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
   at Telerik.Windows.Data.QueryableCollectionView.RefreshAndRaiseCollectionChanged(NotifyCollectionChangedEventArgs args)
   at Telerik.Windows.Data.QueryableCollectionView.OnSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
   at Telerik.Windows.Data.QueryableCollectionView.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs args)
   at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Windows.Controls.Ria.DomainDataSourceView.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Windows.Controls.Ria.DomainDataSourceView.OnCollectionViewCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Windows.Data.EntityCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
   at System.Windows.Data.EntityCollectionView.set_PageSize(Int32 value)
   at System.Windows.Controls.DomainDataSource.PageSizePropertyChanged(DependencyObject depObj, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object newValue, Object oldValue)
   at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isSetByStyle, Boolean isSetByBuiltInStyle, PropertyInvalidationReason reason)
   at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at System.Windows.Controls.DomainDataSource.set_PageSize(Int32 value)
   at MyProject.SL.Controls.Views.ViewActionClientCache.chkClientCache_Click(Object sender, RoutedEventArgs e)

Right now I solved using this workaround:

                    myRadGridView.ItemsSource = null;
                    myDomainDataSource.PageSize = 20;
                    myDomainDataSource.Load();
                    myDomainDataSource.LoadedData += (s, e1) =>
                    {
                        myRadGridView.ItemsSource = domainDataSource.Data;
                    };  

some wrong in what I do... or some bug on RadGridView?

ty in advance,
M.

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 12 May 2010, 08:03 AM
Hi,

Do you have our latest service pack - Q1 2010 SP1?

Regards,
Vlad
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
Marco Barzaghi
Top achievements
Rank 1
answered on 11 Jun 2010, 02:43 PM
I have the same problem. I see the SP1 is only for SL4... I am using SL3, how can I do?

* UPDATE *

ok, I got it. It works.
Tags
GridView
Asked by
Marco Barzaghi
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Marco Barzaghi
Top achievements
Rank 1
Share this question
or