DataGrid binding issues
-
I'm working with the windows forms DataGrid and running into some problems. The DataGrid is bound to a DataView derived from a Dataset, filled by a SqlDataAdapter. I encounter two problems when I call SqlDataAdapter.Fill(dataSet, "Table"): 1) The DataGrid re-sorts based on the first column. 2) If the user had resized any rows, those rows are set back to the default size. Basically, I don't want the appearance of the grid to change when I call Fill(). Is this possible, or do I need to manually manipulate the a dataset. -- James --
-
I'm working with the windows forms DataGrid and running into some problems. The DataGrid is bound to a DataView derived from a Dataset, filled by a SqlDataAdapter. I encounter two problems when I call SqlDataAdapter.Fill(dataSet, "Table"): 1) The DataGrid re-sorts based on the first column. 2) If the user had resized any rows, those rows are set back to the default size. Basically, I don't want the appearance of the grid to change when I call Fill(). Is this possible, or do I need to manually manipulate the a dataset. -- James --
Mmmm.... I have the same problem, but I haven't faced it yet :-) ( now I'm still fixing bugs)... some ideas... You can set the sorting column in the DataView( so it's supossed that the DataGrid has nothing to do then). Before calling Fill, you can store in some temporary array or struct ( Memory DataTable with Display/Value columns would be fine :) , or maybe you can save it like a TableStyle )the pair values of Column Name / Column Width, and restore it after calling Fill... to avoid ugly things or flickers, it must be possible to say the DataGrid, Hey ! don't draw now... and when all is done... Now you can refresh, but not sure how. Good luck ! Braulio