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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Current view of GDBG Grid

Thread ID:





38024 Dec 5,2005 07:07 AM UTC Dec 6,2005 01:36 AM UTC WinForms 7
Tags: GridControl
Administrator [Syncfusion]
Asked On December 5, 2005 07:07 AM UTC

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

stanleyj [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On December 5, 2005 07:12 PM UTC

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

Administrator [Syncfusion]
Replied On 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,

Administrator [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On December 5, 2005 08:44 PM UTC

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

Administrator [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On 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


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon