We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Error when entering data after deleting rows

Thread ID:

Created:

Updated:

Platform:

Replies:

17266 Aug 4,2004 05:59 PM UTC Aug 4,2004 06:53 PM UTC Windows Forms 1
loading
Tags: GridControl
Greg Shomette
Asked On August 4, 2004 05:59 PM UTC

I appreciate the great support you provide! We have a GridDataBoundGrid bound to a child table in a dataset. The grid displays TimeCardDetails children of one TimeCard parent at a time. Before deleting the parent record we call CurrentCell.EndEdit() and Binder.EndEdit(). The child records are successfully deleted and the grid is clear of data. When going into the grid to try and enter new data is when the issue occurs. If one child row was there before the delete we can enter new data without problem. Our code creates a new TimeCard parent when the first detail is added to the grid for the selected day. However, if more than one row of details was in the grid before deletion we get an null reference error. Here is part of the stack: Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.BeginEdit() at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.BeginEdit() at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.OnCurrentCellChanging(CancelEventArgs e) at Syncfusion.Windows.Forms.Grid.GridControlBase.RaiseCurrentCellChanging() at Syncfusion.Windows.Forms.Grid.GridCurrentCell.NotifyChanging() at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.NotifyCurrentCellChanging() at Syncfusion.Windows.Forms.Grid.GridTextBoxCellRenderer.set_TextBoxText(String value) at Syncfusion.Windows.Forms.Grid.GridDropDownGridListControlCellRenderer.SetComboBoxText(String s, Boolean validate, Int32 index) at Syncfusion.Windows.Forms.Grid.GridDropDownGridListControlCellRenderer.ListControlMouseUp(Object sender, MouseEventArgs e) You can see that the error occurs when the GridModelDataBinder.BeginEdit() method is called. Do we need to reset the binder or do something else to create a blank slate? It works fine when there hasn''''t just been a delete. We are coding in VB.Net. Thanks!

Administrator [Syncfusion]
Replied On August 4, 2004 06:53 PM UTC

Are you using 2.0.5.1? You might experiment with setting different values o fthese grid.UseOptimizedListChangeEvent and grid.OptimizeInsertRemoveCells to see if any combination of these properties will allow your code to work. One thing I think would clearly work would be to reset the hierarchies and re-add them as in teh code below. ''Reduce flicker gridDataBoundGrid1.BeginUpdate() gridDataBoundGrid1.Binder.ResetHierarchyLevels() gridDataBoundGrid1.DataSource = Nothing gridDataBoundGrid1.DataMember = "" gridDataBoundGrid1.DataSource = VariableData gridDataBoundGrid1.DataMember = "Parent" ChildrenTable.CreateAllHierarchy() '' Reduce flicker gridDataBoundGrid1.EndUpdate()

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;