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

How to call ResizeToFit after DataBoundGrid is sorted or filtered

Thread ID:





18568 Sep 2,2004 03:47 PM UTC Sep 2,2004 04:41 PM UTC WinForms 2
Tags: GridControl
Luke Middleton
Asked On September 2, 2004 03:47 PM UTC

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 04:24 PM UTC

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 04:41 PM UTC

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.

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