Hi what I want to do is after hte user has dragged a column into a new position in the grid is rewrite my datatable with the new positions of the columns and then their corresponding rows. I know that sounds simple enough but having trouble finding the answer.
Any help appreciated. Thanks.
Hi,
May I ask why you want to recreate your data table? This seems like an odd thing to do based on the column positions in the grid?
I don't think a DataTable has any easy way to rearrange columns, so you would probably have to remove the columns and re-add then. This would be a massive change to the data structure and cause all sorts of notification to be sent to bound controls, which would then get reset and probably lose their current state information.
Basically, because i was given a requirement that when exporting to excel (our own code not infragistics)
that the columns be in the order they had arranged. I was already planning on copying the columns and
rows to a new datatable, then copying that table to the table that is the datasource for the grid. I just am having
trouble reading the grid and the columns to do this. I have no such problem in row filtering.
I suspect another problem I am going to run into is if the grid has a filter applied how I am going be able to
reassign that.
Thank you for your help on this.
Basically I got the excel part. I just need to copy the rows and columns
as shown after the drag to a new datatable,
copy that datatable to the table the grid is bound to and
reapply any existing filters prior to the column drag.
I am sorry for this hassle.
Well, I'm not sure exactly what you are asking. Building the DataTable to export to Excel is really not my area of expertise. But if you are simply asking how you can get the grid columns in order, there are a couple of ways you can do that.
The easiest would be to use grid.ActiveColScrollRegion.VisibleHeaders.
Another way would be to use the GetFirstVisibleColumn method on the band, then use GetRelatedVisibleColumn on each column to loop.
so is there no answer to this? :(
Why can't you use infragistics export to excel? It handles just anything you could ever want to do? When it come to filters use the filtered in logic to determin what rows to export. You could export the filtered in rows to CSV and that will load into excel just fine.