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. Image for the cookie policy date

Current view of GDBG Grid

I am using GDBG in a hierarchical view. I have an option on my form called “refresh data”, when a use click on this option I need to refresh the data in grid from database. Everything is working fine except that my grid collapse and user has to click again to reach appropriate view. I need to keep the current view of grid, I mean whatever level is expanded or whatever is collapse, I should keep the same. It should behave like that nothing happened except that numbers are changed. Please help me with this. VS

7 Replies

ST stanleyj Syncfusion Team December 5, 2005 12:05 PM UTC

Hi VS, You will have to save the expanded states before updating or giving "refresh data" and then restore them afterwards. Here is a thread that deals with this and there is a sample too. Best regards, Stanley


AD Administrator Syncfusion Team December 5, 2005 07:12 PM UTC

it would be great if there is a c# sample? Thanks, VS


AD Administrator Syncfusion Team December 5, 2005 07:33 PM UTC

It is working now. I have flickering my grid now. how can i avoid this? I am using the following code. // save row state ArrayList alRowState = SaveOpenRows(); // start grid formatting this.gdbgDepartmentBudget.BeginUpdate(); this.gdbgDepartmentBudget.Binder.ResetHierarchyLevels(); this.gridBudgetModel = this.gdbgDepartmentBudget.Model; this.gridBudgetBinder = this.gdbgDepartmentBudget.Binder; this.gdbgDepartmentBudget.DataSource = null; this.gdbgDepartmentBudget.DataMember = null; this.gdbgDepartmentBudget.DataMember = "budgetExpenseCategory"; this.gdbgDepartmentBudget.DataSource = dsDepartmentBudgetDetail; gridBudgetBinder.AddRelation("Level1"); this.gdbgDepartmentBudget.EndUpdate(); this.gdbgDepartmentBudget.Refresh(); SetOpenRows(alRowState); thanks,


AD Administrator Syncfusion Team December 5, 2005 08:30 PM UTC

The ResetHierarchyLevels triggers a ListChanged.Reset. In this case that BeginUpdate/EndUpdate does not avoid the flicker. One other thing you can add a FreezePainting property to the grid to stop the painting in a different way that usually works. Here is a forum link with sample code on this technique. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=16065


AD Administrator Syncfusion Team December 5, 2005 08:44 PM UTC

I am totally un-familiar with VB. do you have c# version of this sample? Thanks,


AD Administrator Syncfusion Team December 5, 2005 10:47 PM UTC

I tried to convert the VB code into c# but is is not doing anything. #region "Code to Freeze System Painting for this grid" private const int WM_SETREDRAW = 11; private int paintFrozen; [DllImport("User32.dll", CharSet=CharSet.Auto)] public static extern bool SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); private bool FreezePainting { get {return (paintFrozen > 0); } set { if (value && this.IsHandleCreated && this.Visible) { if (0 == paintFrozen) { paintFrozen = paintFrozen + 1; SendMessage(Handle, WM_SETREDRAW, 0, 0); } else paintFrozen = paintFrozen + 1; } if (!value) { if (paintFrozen == 0) return; paintFrozen = paintFrozen - 1; if (0 == paintFrozen) { SendMessage(Handle, WM_SETREDRAW, 1, 0); this.Invalidate(true); } } } } #endregion


AD Administrator Syncfusion Team December 6, 2005 01:36 AM UTC

Here is the sample back with a C# project added showing how to save and restore the expand state using a new Freezepainting property added to teh grid. http://www.syncfusion.com/Support/user/uploads/SortExpanded_10ff528c.zip

Loader.
Live Chat Icon For mobile
Up arrow icon