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?