Bug Report T110105
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

Master rows in a hierarchical XtraGrid are collapsed where I accept the changes on a DataTable

Master rows are collapsed when the ListChanged event is raised

created 11 years ago (modified 11 years ago)

I have a Visual Studio 2008 application targeting Dot 3.5 using Dev Express v2012 version 2.16.  In my application I have a GridControl with a master-detail relationship where the GridControl is configured to Auto-Zoom the detail.

When I expand the Customer master record, the Part Number detail GridView is displayed.  When in the Part Number GridView I am able to do everything except post data changes.  There are two problems.

One, if I select a cell, modify the data, and the use the up or down arrow key to scroll off the current record and thus fire the RowUpdated event the follow except is thrown
=======
System.NullReferenceException was unhandled
  Message="Object reference not set to an instance of an object."
  Source="DevExpress.XtraGrid.v12.2"
  StackTrace:
       at DevExpress.XtraGrid.Views.Grid.Handler.GridRegularRowNavigator.OnKeyDown(KeyEventArgs e)
       at DevExpress.XtraGrid.Views.Grid.Handler.GridHandler.OnKeyDown(KeyEventArgs e)
       at DevExpress.XtraGrid.Views.Grid.Handler.GridHandler.ProcessKey(KeyEventArgs e)
       at DevExpress.Utils.Controls.BaseHandler.ProcessEvent(EventType etype, Object args)
       at DevExpress.XtraGrid.Views.Base.Handler.BaseViewHandler.ProcessEvent(EventType etype, Object args)
       at DevExpress.XtraGrid.GridControl.RaiseEditorKeyDown(KeyEventArgs e)
       at DevExpress.XtraEditors.Container.EditorContainer.DevExpress.XtraEditors.Container.IEditorContainer.OnEditorKeyDown(KeyEventArgs e)
       at DevExpress.XtraEditors.BaseEdit.OnEditorKeyDown(KeyEventArgs e)
       at DevExpress.XtraEditors.TextEdit.OnEditorKeyDown(KeyEventArgs e)
       at DevExpress.XtraEditors.BaseEdit.OnKeyDown(KeyEventArgs e)
       at DevExpress.XtraEditors.TextEdit.OnMaskBox_KeyDown(Object sender, KeyEventArgs e)
       at System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)
       at DevExpress.XtraEditors.Mask.MaskBox.OnKeyDown(KeyEventArgs e)
       at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
       at DevExpress.XtraEditors.Mask.MaskBox.ProcessKeyEventArgs(Message& m)
       at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
       at System.Windows.Forms.Control.WmKeyChar(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
       at System.Windows.Forms.TextBox.WndProc(Message& m)
       at DevExpress.XtraEditors.Mask.MaskBox.BaseWndProc(Message& m)
       at DevExpress.XtraEditors.Mask.MaskBox.MaskStrategy.SimpleStrategy.DoWndProc(Message& m)
       at DevExpress.XtraEditors.Mask.MaskBox.WndProc(Message& m)
       at DevExpress.XtraEditors.TextBoxMaskBox.WndProc(Message& msg)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at WindowsFormsApplication1.Program.Main() in D:\VSN2008\MyDocuments\Projects\Net35\TestWindowsFormsApplication\WindowsFormsApplication1\Program.cs:line 17
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:
=======

Two, if I select a cell, modify the data, and use a ControlNavigator’s EndEdit button to post the data change, while the data posts, the GridControl closes the Part Number GridView detail and reverts to displaying the Customer master GridView, which should not happen.

Both these issues need to be fixed.  Neither of these issues existed in Dot Net 2.0 using Dev Express v2011 version 1.10.  When I reverted my current Dot 3.5 / DevX 12.2.16 application back to Dot Net 2.0 / DevX 11.1.10 both problems above went away.  In addition, I have an older, existing, similar Dot 2.0 / DevX 11.1.10 application that works fine as well, which is what prompted me to revert my current application back to Dot Net 2.0 / DevX 11.1.10 in the first place.

I am attaching a sample (or will when you request it… this won't go through with the sample attached).  I hate to have to mark this as urgent, but I don’t want to deliver my current customer project as a Dot 2.0 / DevX 11.1.10 application.

Any help with this will be appreciated.

Thanks,

Vince

Show previous comments (2)
DevExpress Support Team 11 years ago

    Hi Vince,

    Thank you for your patience. I can't reproduce this issue on my side. I have attached my project. Test how it works on your side. Is the issue reproducible with it? We had a similar issue before. Review the NullReferenceException when editing in an detail grid and reloading datasource ticket. In that ticket, the cause of the issue was that the Grid data source was changed in the data source' ListChanged event handler. This broke the normal Grid behavior. Check if you have similar code in your project. If it's not the case, please provide us with a small project that illustrates the issue.

      I have downloaded your example but still cannot attach mine.  How small does it have to be?  Everything is in a zip file that is all of 264 KB.

        Your example is not posting data changes.  My app posts data changes to the database in the GridView's RowUpdated event.  This works fine using DevExpress v2011 version 1.10.  Use DevExpress v2012 version 2.7 to 2.16, that exact same code causes access violations and diplay glitches.  Didn't try DevExpress versions in between, so I'm not sure where/when the master/detail quit working as it did in 11.1.10.
        Please let me know how to submit my sample.
        Thanks.

        Answers approved by DevExpress Support

        created 11 years ago (modified 7 years ago)

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

        Additional information:

        We have decided to persist the current behavior, i.e. collapse detail views when the ListChanged is raised with Reset type = Reset. However, due to many requests from many customers, we also provided an opportunity no prevent collapsing detail views in this case. This behavior can be enabled by using the CollapseDetailRowsOnReset property at the internal DataController class level:

        C#
        gridView1.DataController.CollapseDetailRowsOnReset = false;

        (Take special note the DataController property is not visible in IntelliSense)

        In older versions, store the Grid's state using the approach illustrated in the How to preserve the XtraGrid view state in multi level master/detail example.

          Show previous comments (3)

            Actually, it is broken in 17.1.7.  If you edit and post on the master record while the detail is expanded, the detail, while the detail itself remains expanding, all the detail records disappear from the display.

            With 17.2.7 this doesn't occur and works fine.

              thanks for your answers. I posted in new ticket opened by Svetlana.

              Sasha (DevExpress Support) 7 years ago

                Hello Vince and Yannik,

                @Vince
                To process your recent post in the most efficient manner, I've created a separate ticket on your behalf: GridControl - Detail view's rows disappear after editing the key column in the master view. I will address it shortly.

                @Yannik
                I see your comment in the Master rows are collapsed when the ListChanged event with Reset is raised thread. Let's continue the discussion there.

                created 11 years ago

                Hi Vince,

                Thank you for your project. The cause of the issue is that you call the DataSet.AcceptChanges method in the GridView.RowUpdated event handler. This sends the Reset notification to the Grid and the latter recalculates its layout. To resolve the issue, save changes via BeginInvoke and save the current expanded master row to expand it again after calling the DataSet.AcceptChanges method. This behavior is described in the Q483431 ticket. I have attached a modified project.

                  Show previous comments (5)

                    For the record, I ran the user's sample for B213226.  I agree the issue needed to be fixed.  But at the same time, the GridControl also needs to support the behavior of 11.1.10.  To me both use cases are valid and need to behave correctly.  Also, you have the code for both scenarios, cannot a new boolean property be added to toggle the behavior?  Depending on the situation neither implementation always provides the desired result, but with both implementations and a new boolean property an application developer could achieve the desired result, by simply changing a property setting.  Thoughts?

                    Yaroslav (DevExpress Support) 11 years ago

                      Hi Vince,
                      I'm afraid there is no such workaround that will remove the flickering issue completely in the current version of our components. As for a custom property, I agree with you that it will be useful for many customers. I'll contact our developers again to check if it's possible to implement such an approach without breaking the existing functionality. I'll reply in this ticket once I have any results.

                        Yes, while I was able to code around the rest I could not get rid of the flickering.  For now, I'm just going to deploy my app with the 11.1.10 .dll files.
                        I look forward to hearing the Developers reply.

                        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

                        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.