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

radGridView + radDataPager : Adding new Item

0 Answers 92 Views
DataPager
This is a migrated thread and some comments may be shown as answers.
Bilel
Top achievements
Rank 1
Bilel asked on 30 Dec 2012, 05:36 PM
Hello

I'm creating a RadGridView with a RadDataPager in a WPF window. All seem to work correclty but when I try to add a new item to the grid (New row), the application crach and generate a cast exception that a can neither understand nor catche. My GridView is binded to the data collection and the Pager in linked to the GridView.

Here is the Exception message :

Unable to cast object of type 'App.BO.Entitys.Article' to type  'System.Data.Entity.DynamicProxies.Article_3C0917478FAD0B1FFBB724608BC9377A6E5813A3464003EFD3914700EBF2EA8C'

And here is the StackTrace : 

at System.Linq.Enumerable.<CastIterator>d__b1`1.MoveNext()
at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
at lambda_method(Closure )
at System.Linq.EnumerableExecutor`1.ExecuteBoxed()
at Telerik.Windows.Data.QueryableExtensions.Count(IQueryable source) dans c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableExtensions.cs:ligne 409
at Telerik.Windows.Data.QueryableCollectionView.GetPagingDeterminativeItemCount() dans c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.Paging.cs:ligne 432
at Telerik.Windows.Data.QueryableCollectionView.get_PagingDeterminativeItemCount() dans c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.Paging.cs:ligne 419
at Telerik.Windows.Data.QueryableCollectionView.GetEffectiveItemCount() dans c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.Paging.cs:ligne 402
at Telerik.Windows.Data.QueryableCollectionView.UpdateItemCount() dans c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.Paging.cs:ligne 395
at Telerik.Windows.Data.QueryableCollectionView.AddItemToSourceList(Object newItem) dans c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.Editing.cs:ligne 485
at Telerik.Windows.Data.QueryableCollectionView.AddNewInternal(Object newItem) dans c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.Editing.cs:ligne 458
at Telerik.Windows.Data.QueryableCollectionView.AddNew(Object newItem) dans c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.Editing.cs:ligne 281
at Telerik.Windows.Data.QueryableCollectionView.AddNewItem(Object newItem) dans c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.Editing.cs:ligne 261
at Telerik.Windows.Data.DataItemCollection.AddNew(Object newItem) dans c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\DataItemCollection.Editing.cs:ligne 63
at Telerik.Windows.Controls.GridView.GridViewDataControl.CreateNewItem() dans c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:ligne 5523
at Telerik.Windows.Controls.GridView.GridViewDataControl.ShowInsertRowIfNeeded() dans c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:ligne 5455
at Telerik.Windows.Controls.GridView.GridViewDataControl.BeginInsert() dans c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:ligne 5077
at Telerik.Windows.Controls.GridView.GridViewDataControl.OnBeginInsertCommand(Object sender, ExecutedRoutedEventArgs e) dans c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Commands.cs:ligne 382
at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run()
at App.GUI.App.Main() dans d:\Work\Projects\Apps\Dev\App\App.GUI\obj\Debug\App.g.cs:ligne 0
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()


So, is there a way to resolve the problem.
Thanks

No answers yet. Maybe you can help?

Tags
DataPager
Asked by
Bilel
Top achievements
Rank 1
Share this question
or