This is a migrated thread and some comments may be shown as answers.
Grid Filter issue
3 Answers 24 Views
This is a migrated thread and some comments may be shown as answers.
Liyo
Top achievements
Rank 1
Liyo asked on 17 Sep 2013, 10:17 AM
Hi all,
I have i have bind my grid to a dynamic object. I am getting following error file i try to filter the grid. 


Message: System.InvalidOperationException: The result of the dynamic binding produced by the object with type 'Demo.MyDataRow' for the binder 'Telerik.Windows.Data.SimpleGetIndexBinder' needs at least one restriction.
   at System.Dynamic.DynamicMetaObjectBinder.Bind(Object[] args, ReadOnlyCollection`1 parameters, LabelTarget returnLabel)
   at System.Runtime.CompilerServices.CallSiteBinder.BindCore[T](CallSite`1 site, Object[] args)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
   at lambda_method(Closure , MyDataRow )
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.<DistinctIterator>d__81`1.MoveNext()
   at System.Linq.Enumerable.<TakeIterator>d__3a`1.MoveNext()
   at Telerik.Windows.Controls.GridView.DistinctValueViewModelCollection.AddRangeFromSource(IEnumerable source)
   at Telerik.Windows.Controls.GridView.DistinctValueViewModelCollection.SetSource(IEnumerable source)
   at Telerik.Windows.Controls.GridView.FilteringViewModel.RefreshDistinctValues()
   at Telerik.Windows.Controls.GridView.FilteringViewModel.Refresh()
   at Telerik.Windows.Controls.GridView.FilteringControl.Prepare(GridViewColumn columnToPrepare)
   at Telerik.Windows.Controls.GridView.FilteringDropDown.PrepareFilteringControl()
   at Telerik.Windows.Controls.GridView.FilteringDropDown.OnDropDownPopupOpened(Object sender, EventArgs e)
   at Telerik.Windows.Controls.AutoClosePopupWrapper.OnPopupOpened(Object sender, EventArgs e)
   at MS.Internal.CoreInvokeHandler.InvokeEventHandler(UInt32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)     



Can anyone please help me on this.

i have attached my solution at following path.
http://sdrv.ms/1ekZ5D0


Regards,
Liyo Jose.

3 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 17 Sep 2013, 01:40 PM
Hi,

Please, try to correctly override and implement the TryGetIndex and TrySetIndex methods (just as you have done with TryGetMember and TrySetMember) on your dynamic object since you are accessing the Cells through its indexer. Maybe this will help.

Regards,

Rossen Hristov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Liyo
Top achievements
Rank 1
answered on 20 Sep 2013, 01:47 PM
Thanks for your support,

I have  override  TrySetIndex and TryGetIndex functions and set 
column.FilterMemberPath property but i does't seems to work.

Please download and check the project from below path.

http://sdrv.ms/1fhkjk7
Regards,
Liyo Jose.
0
Rossen Hristov
Telerik team
answered on 23 Sep 2013, 07:13 AM
Hi,

After a lot of debugging I found out what the problem is. Unfortunately, the data engine cannot handle a case like yours -- i.e. when you have a dynamic object which returns another normal object (Cell) and you want to drill down into its properties. When we enter the dynamic paradigm we cannot go outside it when trying to resolve properties. We don't know what this dynamic object will return and we cannot generate a member access expression unfortunately.

We support dynamic objects but you can only use their direct properties or indices, i.e. you cannot return a Cell for everything and then drill down into its Text property. You can, but we cannot support this scenario and build the correct LINQ expression at runtime.

If you modify your dynamic object to directly return the Text when asked about ["ID"] or ["Name"] then things should work. You will have to change the Binding of course to be [{0}] and help the column by setting its DataType to typeof(string). In other words -- eliminate the ".Text" part from the whole design.

Regards,
Rossen Hristov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Asked by
Liyo
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Liyo
Top achievements
Rank 1
Share this question
or