This question is locked. New answers and comments are not allowed.
Hi
I am using
RadGridView version 2010.3.1304.1040(the latest hotfix internal build) because you haven't still released any new one yet
Right now for my Master-Detail scene. The radgridview will contain a collection of Detail. Above it, i will have some textbox to let user type in the properties for Master entity.
For a newly created Master one(called Document entity), i will input some DETAIL for that document (called DocumentLines).
The pressing INSERT works fine. However if i press DELETE , i always get this below error.
For the code, i don't do anything on my Deleted event handler or even Deleting. For my RadGridView, i only have the event AddingNewDataItem() and RowEditedEnd().
Please note that: instead of creating new MASTER-DETAIL, if i use my search feature to retrieve the available one Master-Detail, then the DELETE work fine for my DETAIL radgridview.
Object reference not set to an instance of an object.
at System.ServiceModel.DomainServices.Client.EntityCollection`1.ListCollectionViewProxy`1.Remove(Object value)
at System.ServiceModel.DomainServices.Client.EntityCollection`1.ListCollectionViewProxy`1.RemoveAt(Int32 index)
at System.Windows.Data.ListCollectionView.RemoveAt(Int32 index)
at System.Windows.Data.ListCollectionView.Remove(Object item)
at Telerik.Windows.Controls.GridView.GridViewDataControl.DeleteItems(IEnumerable`1 itemsToDelete)
at Telerik.Windows.Controls.GridView.GridViewDataControl.DeleteSelectedItems()
at Telerik.Windows.Controls.GridView.GridViewDataControl.TryDeleteSelectedItems()
at Telerik.Windows.Controls.GridView.GridViewDataControl.OnDeleteCommand(Object sender, ExecutedRoutedEventArgs e)
at Telerik.Windows.Controls.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at Telerik.Windows.Controls.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at Telerik.Windows.Controls.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at Telerik.Windows.Controls.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at Telerik.Windows.Controls.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
at Telerik.Windows.RadRoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at Telerik.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RadRoutedEventArgs routedEventArgs)
at Telerik.Windows.EventRoute.InvokeHandlersImpl(Object source, RadRoutedEventArgs args, Boolean raisedAgain)
at Telerik.Windows.RadRoutedEventHelper.RaiseEvent(DependencyObject element, RadRoutedEventArgs args)
at Telerik.Windows.Controls.RoutedCommand.ExecuteImpl(Object parameter, UIElement target)
at Telerik.Windows.Controls.RoutedCommand.Execute(Object parameter, UIElement target)
at Telerik.Windows.Controls.GridView.GridViewDataControl.OnKeyDown(KeyEventArgs e)
at System.Windows.Controls.Control.OnKeyDown(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
I am using
RadGridView version 2010.3.1304.1040(the latest hotfix internal build) because you haven't still released any new one yet
Right now for my Master-Detail scene. The radgridview will contain a collection of Detail. Above it, i will have some textbox to let user type in the properties for Master entity.
For a newly created Master one(called Document entity), i will input some DETAIL for that document (called DocumentLines).
The pressing INSERT works fine. However if i press DELETE , i always get this below error.
For the code, i don't do anything on my Deleted event handler or even Deleting. For my RadGridView, i only have the event AddingNewDataItem() and RowEditedEnd().
Please note that: instead of creating new MASTER-DETAIL, if i use my search feature to retrieve the available one Master-Detail, then the DELETE work fine for my DETAIL radgridview.
Object reference not set to an instance of an object.
at System.ServiceModel.DomainServices.Client.EntityCollection`1.ListCollectionViewProxy`1.Remove(Object value)
at System.ServiceModel.DomainServices.Client.EntityCollection`1.ListCollectionViewProxy`1.RemoveAt(Int32 index)
at System.Windows.Data.ListCollectionView.RemoveAt(Int32 index)
at System.Windows.Data.ListCollectionView.Remove(Object item)
at Telerik.Windows.Controls.GridView.GridViewDataControl.DeleteItems(IEnumerable`1 itemsToDelete)
at Telerik.Windows.Controls.GridView.GridViewDataControl.DeleteSelectedItems()
at Telerik.Windows.Controls.GridView.GridViewDataControl.TryDeleteSelectedItems()
at Telerik.Windows.Controls.GridView.GridViewDataControl.OnDeleteCommand(Object sender, ExecutedRoutedEventArgs e)
at Telerik.Windows.Controls.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at Telerik.Windows.Controls.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at Telerik.Windows.Controls.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
at Telerik.Windows.Controls.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
at Telerik.Windows.Controls.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
at Telerik.Windows.RadRoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at Telerik.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RadRoutedEventArgs routedEventArgs)
at Telerik.Windows.EventRoute.InvokeHandlersImpl(Object source, RadRoutedEventArgs args, Boolean raisedAgain)
at Telerik.Windows.RadRoutedEventHelper.RaiseEvent(DependencyObject element, RadRoutedEventArgs args)
at Telerik.Windows.Controls.RoutedCommand.ExecuteImpl(Object parameter, UIElement target)
at Telerik.Windows.Controls.RoutedCommand.Execute(Object parameter, UIElement target)
at Telerik.Windows.Controls.GridView.GridViewDataControl.OnKeyDown(KeyEventArgs e)
at System.Windows.Controls.Control.OnKeyDown(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
#region Adding/Edited/Delete event handler for documentLine radgridview private void documentLineRadGridView_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e) { //setting the default cursor position this.documentLineRadGridView.CurrentColumn = this.documentLineRadGridView.Columns[0]; var documentLine = new DocumentLine(); // setting DocumentId for each DocumentLine basing on the current Document documentLine.DocumentId = document.DocumentId; documentLine.InsertUserId = userId; documentLine.InsertDate = DateTime.Now; documentLine.UpdateUserId = userId; documentLine.UpdateDate = DateTime.Now; // Extra fields will be handled later //setting default value for Account/Department basing on Vendor ID radcombobox if (BusinessEntityIdRCB.SelectedItem != null) { var bARInfo = (BusinessEntityIdRCB.SelectedItem as BusinessEntity).BusinessARInfoes.First(); if (bARInfo != null) { documentLine.FinancialAccountId = bARInfo.DefaultIncomeAccountId.GetValueOrDefault(); documentLine.FinancialDepartmentId = bARInfo.DefaultIncomeDepartmentId.GetValueOrDefault(); } } // documentLine.Balanceable = 0; documentLine.DocumentTypeId = document.DocumentTypeId; documentLine.DocumentLineTypeId = 1; documentLine.ModuleId = 4; documentLine.ReferenceNumber = string.Empty; documentLine.TransactionDate = DocumentARDateRDP.SelectedDate.GetValueOrDefault(); documentLine.TransactionDescription = (DocumentDescriptionTB.Text == null) ? string.Empty : DocumentDescriptionTB.Text; documentLine.DebitAmount = 0; documentLine.CreditAmount = 0; documentLine.Unit = 0; documentLine.UnitPrice = 0; // document.DocumentLines1.Add(documentLine); e.NewObject = documentLine; } private void documentLineRadGridView_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e) { //calculate the value of TransactionAmount basing on Debit and Credit DocumentLine newDocumentLine = e.NewData as DocumentLine; // need to check to see whether there are any change or not // if not , no need to update the userId and updateDate for the case // user only click on the row but does nothing if (newDocumentLine.FinancialAccountId != (int)e.OldValues["FinancialAccountId"] || newDocumentLine.TransactionDescription != (string)e.OldValues["TransactionDescription"] || newDocumentLine.TransactionDate != (DateTime)e.OldValues["TransactionDate"] || newDocumentLine.FinancialDepartmentId != (int)e.OldValues["FinancialDepartmentId"] || newDocumentLine.Unit != (decimal)e.OldValues["Unit"] || newDocumentLine.UnitPrice != (decimal)e.OldValues["UnitPrice"] || newDocumentLine.TransactionAmount != (decimal)e.OldValues["TransactionAmount"]) { (e.NewData as DocumentLine).UpdateDate = DateTime.Now; (e.NewData as DocumentLine).UpdateUserId = userId; } } #endregion