We have a grid that we use to display custom fields for a support ticket. It is docked inside another form. The grid has the column "label" sortindicator set as ascending. it is the second column in the grid. When the save data routine on the parent form is called and performs a refresh of the data, the sortindicator seems to be lost and the grid is ordered by the "optionid", which is the first column of the grid. Optionid column is hidden. This appears to have started happening only since we upgraded to version 10.1. is there any issues with the grid in 10.1 that would cause this?
Hi,
btesch said:When the save data routine on the parent form is called and performs a refresh of the data
My guess is that you are not just losing the sort indicator, but rather you are losing the entire layout of the grid. If you are setting the grid's DataSource or doing something that causes the DataSource to send a Reset notification, then the grid has to throw away everything and re-build the data structure and the rows based on the new data source.
The best thing to do is avoid doing this. But if you must do it, then you should save the DisplayLayout of the grid into a MemoryStream and then re-load it after the refresh is complete.
Thanks Mike. I will play around with that and see what I can do. My question now is why did this only start happening when we upgraded to 10.1? Was there some underlying change that brings this out?
Bob
HI ,
I was unable to reproduce this issue.
I bound a grid, sorted it by clicking on the column header. Then via a button click, i refreshed the datasource. The grid was still sorted on the column I clicked.
Here is my refresh code
private void ultraButton1_Click(object sender, EventArgs e) { NwindDataSetTableAdapters.EmployeesTableAdapter emp = new WindowsFormsApplication102.NwindDataSetTableAdapters.EmployeesTableAdapter(); emp.ClearBeforeFill = true; emp.Fill(nds.Employees); ultraGrid1.DataMember = nds.Employees.TableName; ultraGrid1.DataSource = nds; ultraGrid1.DataBind();
}
How are you refreshing your grid?
Sincerely,
Matt
Developer Support Engineer