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
close icon

GDBG cell auto resizing

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.

2 Replies

AD Administrator Syncfusion Team 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???"); } }


AP Atith Pagdi 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?

Loader.
Live Chat Icon For mobile
Up arrow icon