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

GDBG cell auto resizing

Thread ID:





33946 Aug 30,2005 09:50 AM UTC Aug 30,2005 11:52 AM UTC WinForms 2
Tags: GridControl
Atith Pagdi
Asked On August 30, 2005 09:50 AM UTC

How some of the settings in my GDBG are getting reset to defaults after sorting (when the user clicks on one of the col headers). Is there any way I can catch the sort complete event so I can reset the property? I''m trying to apply AutoReSize to cells.

Administrator [Syncfusion]
Replied On August 30, 2005 10:22 AM UTC

You can subscribe to the dataview.ListChanged event associated with the datasource and the grid. There you can test for the Reset setting. This event is raised after a sort. CurrencyManager cm = this.gridDataBoundGrid1.BindingContext[this.gridDataBoundGrid1.DataSource, this.gridDataBoundGrid1.DataMember] as CurrencyManager; ((DataView)cm.List).ListChanged += new ListChangedEventHandler(Form1_ListChanged); private void Form1_ListChanged(object sender, ListChangedEventArgs e) { if(e.ListChangedType == ListChangedType.Reset) { Console.WriteLine("sorted???"); } }

Atith Pagdi
Replied On August 30, 2005 11:52 AM UTC

I tried this approach by adding the event handler in the page load (if I did it in the windows generated code section at the class level, I was getting an object referenced to null exception), but the application started hanging whenever I sorted. Also, in the handler, I put the following code: this.dgTest.Model.RowHeights.ResizeToFit(GridRangeInfo.Cells(0, 1, this.dgTest.Model.RowCount, this.dgTest.Model.ColCount), GridResizeToFitOptions.IncludeHeaders); this.dgEx.Model.RowHeights.ResizeToFit(GridRangeInfo.Cells(0, 1, this.dgEx.Model.RowCount, this.dgEx.Model.ColCount), GridResizeToFitOptions.IncludeHeaders); but the cells still remained the same size as before (too much whitespace in some, and no resizing in others). I want the cells to resize automatically according to the data. On certain events I take some rows out of one data set and insert them into another and vice versa. Any other way of doing this?


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

or the page will be automatically redirected to 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