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

How to call ResizeToFit after DataBoundGrid is sorted or filtered

Thread ID:





18568 Sep 2,2004 11:47 AM Sep 2,2004 12:41 PM Windows Forms 2
Tags: GridControl
Luke Middleton
Asked On September 2, 2004 11:47 AM

I''m performing custom row and column on sizing my GridDataBoundGrid using ResizeToFit(). This works fine after loading data into the grid, but when a user filters (I''m using GridFilterBar) or sorts (clicks on header cells) I need to call ResizeToFit(). It''s not obvious to me what events I should use to keep my grid sized correctly. I tried FilterBarTextChanged, but it seems to be fired before all data is loaded. Thanks for the help!

Administrator [Syncfusion]
Replied On September 2, 2004 12:24 PM

You can try to subscribe to the DataaView''s ListChanged event. There is the type is a Reset, then you can do your resize. Here is code that work for me in our GridFilterBar sample.
//at the bottom of SetTableIntoGridAndWireFilterBar
DataTable dt = this.gridDataBoundGrid1.DataSource as DataTable;
if(dt != null)
	dt.DefaultView.ListChanged += new ListChangedEventHandler(DefaultView_ListChanged);

private void DefaultView_ListChanged(object sender, ListChangedEventArgs e)
	if(e.ListChangedType == ListChangedType.Reset)

Luke Middleton
Replied On September 2, 2004 12:41 PM

Works great! Thank you.


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.

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.