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.

GridDataBoundGrid reset data.

Thread ID:

Created:

Updated:

Platform:

Replies:

20894 Oct 27,2004 10:12 AM Oct 27,2004 03:56 PM Windows Forms 12
loading
Tags: GridControl
kstoj
Asked On October 27, 2004 10:12 AM

Hi! I have a GridDataBoundGrid control in my application. When I add the row to it the data in the previous row is reset to default values for the object. What settings in the grid would cause that. Detail scenario: 1. Add the first object ( row ) to the grid. 2. Changed few setting in the row. 3. Add the second row. 4. The edited values in the row 1 are reset to default values for the bound object. 5. The new row is added with the default values.

Administrator [Syncfusion]
Replied On October 27, 2004 10:54 AM

Set the Debugger in Visual Studio to Break on exception (using the Debug/Exceptions menu and choosing Common Language Rutime), and try your steps. It may be that some exception is being thrown that is causing this behavior. Are you trying to programatically do these steps, or are you typing into teh grid to do these steps? If you are doing this from code, can you post the code you are trying to use? Better yet, can you post a sample project showing the problem?

Administrator [Syncfusion]
Replied On October 27, 2004 11:02 AM

Here is the code which sets up the GDBG. AssignmentGrid.ListBoxSelectionMode = SelectionMode.MultiExtended; AssignmentGrid.SetRowHeight(0, 0, 2 * AssignmentGrid.GetRowHeight(0)); AssignmentGrid.Selections.Clear(); AssignmentGrid.CurrentCellChanged += new EventHandler(AssignmentGrid_CurrentCellChanged); AssignmentGrid.RowEnter += new GridRowEventHandler(AssignmentGrid_RowEnter); this.AssignmentGrid.RowLeave += new Syncfusion.Windows.Forms.Grid.GridRowEventHandler(this.AssignmentGrid_RowLeave); AssignmentGrid.MouseDown += new MouseEventHandler(AssignmentGrid_MouseDown); AssignmentGrid.AllowDragSelectedCols = true; AssignmentGrid.ListBoxSelectionMode = System.Windows.Forms.SelectionMode.None; AssignmentGrid.Properties.RowHeaders = true; AssignmentGrid.ActivateCurrentCellBehavior = Syncfusion.Windows.Forms.Grid.GridCellActivateAction.ClickOnCell; AssignmentGrid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(AssignmentGrid_PrepareViewStyleInfo); AssignmentGrid.GridBoundColumns.AddRange(this.gridColumns);

Administrator [Syncfusion]
Replied On October 27, 2004 11:08 AM

Here is the code which sets up the GDBG. AssignmentGrid.ListBoxSelectionMode = SelectionMode.MultiExtended; AssignmentGrid.SetRowHeight(0, 0, 2 * AssignmentGrid.GetRowHeight(0)); AssignmentGrid.Selections.Clear(); AssignmentGrid.CurrentCellChanged += new EventHandler(AssignmentGrid_CurrentCellChanged); AssignmentGrid.RowEnter += new GridRowEventHandler(AssignmentGrid_RowEnter); this.AssignmentGrid.RowLeave += new Syncfusion.Windows.Forms.Grid.GridRowEventHandler(this.AssignmentGrid_RowLeave); AssignmentGrid.MouseDown += new MouseEventHandler(AssignmentGrid_MouseDown); AssignmentGrid.AllowDragSelectedCols = true; AssignmentGrid.ListBoxSelectionMode = System.Windows.Forms.SelectionMode.None; AssignmentGrid.Properties.RowHeaders = true; AssignmentGrid.ActivateCurrentCellBehavior = Syncfusion.Windows.Forms.Grid.GridCellActivateAction.ClickOnCell; AssignmentGrid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(AssignmentGrid_PrepareViewStyleInfo); AssignmentGrid.GridBoundColumns.AddRange(this.gridColumns); // // AssignmentGrid // AssignmentGrid.VerticalThumbTrack = true; AssignmentGrid.HorizontalThumbTrack = true; AssignmentGrid.AccessibilityEnabled = true; AssignmentGrid.ActivateCurrentCellBehavior = Syncfusion.Windows.Forms.Grid.GridCellActivateAction.DblClickOnCell; AssignmentGrid.AllowDragSelectedCols = true; AssignmentGrid.AllowDrop = true; AssignmentGrid.ControllerOptions = ((Syncfusion.Windows.Forms.Grid.GridControllerOptions)(((((Syncfusion.Windows.Forms.Grid.GridControllerOptions.ClickCells | Syncfusion.Windows.Forms.Grid.GridControllerOptions.DragSelectRowOrColumn) | Syncfusion.Windows.Forms.Grid.GridControllerOptions.SelectCells) | Syncfusion.Windows.Forms.Grid.GridControllerOptions.ExcelLikeSelection) | Syncfusion.Windows.Forms.Grid.GridControllerOptions.ResizeCells))); this.AssignmentGrid.Dock = System.Windows.Forms.DockStyle.Fill; AssignmentGrid.ListBoxSelectionMode = System.Windows.Forms.SelectionMode.MultiSimple; AssignmentGrid.Location = new System.Drawing.Point(0, 0); this.AssignmentGrid.Name = "AssignmentGrid"; AssignmentGrid.OptimizeInsertRemoveCells = true; AssignmentGrid.Properties.RowHeaders = false; AssignmentGrid.ShowCurrentCellBorderBehavior = Syncfusion.Windows.Forms.Grid.GridShowCurrentCellBorder.GrayWhenLostFocus; AssignmentGrid.Size = new System.Drawing.Size(354, 264); AssignmentGrid.SortBehavior = Syncfusion.Windows.Forms.Grid.GridSortBehavior.DoubleClick; AssignmentGrid.TabIndex = 0; AssignmentGrid.UseListChangedEvent = true; Here is the code which is called to add the new row to the Collection bound to the Grid: AssignmentGrid.BeginUpdate(); WorkAssignment workAssignment = null; workAssignment = wrapper.manageDailyAssignments.CreateNewWithDefaults(); DailyAssignmentWrapper newAssignment = new DailyAssignmentWrapper(workAssignment, wrapper.manageDailyAssignments.FieldWorkers); newAssignment.IsDirty = true; wrapper.Add(newAssignment); AssignmentGrid.EndUpdate(); I setup the break point at the time when the OnListChanged event is called and within the Set for the affected proeprties on the bound object. I''m breaking in both places on what looks like the Syncfusion calls but can''t figure out why the previous row is rewritten with the default values.

Administrator [Syncfusion]
Replied On October 27, 2004 11:34 AM

Exactly what is the DataSource here? It looks like some kind of custom collection, correct? Does it implement IBindingList? If you place a stop down in the collection code, do you see the values saved as they should be when you leave the grid row?

Administrator [Syncfusion]
Replied On October 27, 2004 12:16 PM

Another thing to try would be to drop a WindowsForms DataGrid on a form and try to use it to update your custom collection to see if that works. If it does, just drop a GridDataBoundGrid on the same form and see if that works. This way you might be able to narrow down what is not working properly.

Administrator [Syncfusion]
Replied On October 27, 2004 01:02 PM

Yes, it is a custom collection and it does implement IBindingList. >Exactly what is the DataSource here? It looks like some kind of custom collection, correct? > >Does it implement IBindingList? If you place a stop down in the collection code, do you see the values saved as they should be when you leave the grid row?

Administrator [Syncfusion]
Replied On October 27, 2004 01:45 PM

I modified our customers sample which uses a custom collection to see if I could reproduce the problem. It is attached below. The Test button will add a new row directly to the custom collection, and it does not seem to prevent the grid from saving changes that have been made. Can you reproduce the problem in this sample? CS_2045.zip

Administrator [Syncfusion]
Replied On October 27, 2004 03:21 PM

Hi! I changed the properties of your grid to resamble all the setting I''m using include call backs ( all included in the attached file ). After that the behavior changed similar to the problems I''m having. Here is the description of the steps: 1. Run application. 2. Two rows show up in the Grid. 3. Press "Test" button. 4. Two rows are added to the Grid First added row: ID = 10, First Name = First10, Second added row: ID = 2, First Name = "" 5. Click ID Cell ( Value 10 ) on the first added row. 6. Change the ID from 10 to 20. 7. Don''t leave the cell and press "Test" key. 8. The ID Cell value is changed to 3, the First Name cell value in the first added row disapears. The behavior I would excpect is that the ID cell value and First name cell string are not changed in the first added row but the new row is added. Sorry for the spelling errors. >I modified our customers sample which uses a custom collection to see if I could reproduce the problem. It is attached below. The Test button will add a new row directly to the custom collection, and it does not seem to prevent the grid from saving changes that have been made. > >Can you reproduce the problem in this sample? > >CS_2045.zip > > ModifiedSample_24.zip

Administrator [Syncfusion]
Replied On October 27, 2004 03:37 PM

In your sample, when I click the Test button, I only get a single row with the value 10 in it. I do not see a second row with a 2 in it. Did you send the sample you wanted to send? The buttonn handler for the Test button in your sample seems to be the same as the original sample.

Administrator [Syncfusion]
Replied On October 27, 2004 03:48 PM

I am using version 2.1.0.9. What version are you using?

Administrator [Syncfusion]
Replied On October 27, 2004 03:52 PM

Hi! I think I send all the right stuff, but in case I''m reposting the Zip file just to be sure. >In your sample, when I click the Test button, I only get a single row with the value 10 in it. I do not see a second row with a 2 in it. Did you send the sample you wanted to send? The buttonn handler for the Test button in your sample seems to be the same as the original sample. ModifiedSample_2239.zip

Administrator [Syncfusion]
Replied On October 27, 2004 03:56 PM

I''m using 2.0.5.14. I will do an upgrade and see if that changes anything. >I am using version 2.1.0.9. What version are you using?

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.

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.

;