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

Changing bound columns in real time

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();

1 Reply

AD Administrator Syncfusion Team 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();

Live Chat Icon For mobile
Up arrow icon