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

[Solved] Error on "Delete" keyboard for the LATEST internal build version of RadGridView

3 Answers 154 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tai
Top achievements
Rank 1
Tai asked on 14 Jan 2011, 12:17 AM
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)
#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



3 Answers, 1 is accepted

Sort by
0
Tai
Top achievements
Rank 1
answered on 17 Jan 2011, 08:37 PM
i still need help here

thank you
0
Yordanka
Telerik team
answered on 18 Jan 2011, 11:42 AM
Hello Tai,

Unfortunately, we were unable to reproduce such exception. We may suggest you to try our latest official build Q32010 SP1 released last Friday. In case that does not help please send us a sample application that shows the problem (via support ticket). Thank you.
 
All the best,
Yordanka
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Tai
Top achievements
Rank 1
answered on 26 Jan 2011, 07:40 PM
Hi

i tried a lot of method and still couldn't fix it

i have just sent the sample project through the support ticket to produce the problem

Your ticket ID is: 388213
plz help me

thank you
Tags
GridView
Asked by
Tai
Top achievements
Rank 1
Answers by
Tai
Top achievements
Rank 1
Yordanka
Telerik team
Share this question
or