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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Changing bound columns in real time

Thread ID:





10086 Jan 22,2004 04:06 AM UTC Jan 22,2004 06:29 AM UTC WinForms 1
Tags: GridControl
Asked On January 22, 2004 04:06 AM UTC

I want to change the bound columns in a databound grid while retaining the dataset. I want to be able to do this for 2 reasons. 1) i want the user to be able to add and remove columns 2) i want to change the entire set of visible columns to another subset without having to recreate the grid (lets say i show 10 out of a possible 50 and i have a combobox to decide which subset). I have achieved this but i can actually see each column appearing and it takes a few seconds to add them. How can I prevent this flickering. I''ve tried suspending the layout but that doesnt make a difference. Also if i remove the columns and add new ones then i have to reset the datasource to see the data. Why is this? --- this.SuspendLayout(); this.Model.SuspendChangeEvents(); this.GridBoundColumns.Clear(); foreach (string col in colNames) { GridBoundColumn gbc = new GridBoundColumn(); gbc.MappingName = col; gbc.ReadOnly = true; this.GridBoundColumns.Add(gbc); } this.Model.ResumeChangeEvents(); this.ResumeLayout(); this.Refresh();

Administrator [Syncfusion]
Replied On January 22, 2004 06:29 AM UTC

Try sandwiching your code with these calls: grid.BeginUpdate(); grid.Binder.SuspendBinding(); //your code grid.Binder.ResumeBinding(); grid.EndUpdate() //and possibly (if needed) //grid.Refresh();


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