Home › Forums › WinForms controls › Xceed Grid for WinForms › Bound grid – data source column changes
-
AuthorPosts
-
#15431 |
Hi,
I have a grid with lots of data bound columns. I spent much time getting all the column location, width, formating, and other properties set up using the designer. We had to make changes to the database table, and now the grid’s data source has new columns.
How do I add the new columns in the data source without wiping out all my current column settings for the grid?
Thanks
Hao
Imported from legacy forums. Posted by hao_jiang (had 2846 views)
You have basically only one option if you do not want to loose all your work. Before changing the DataSource/DataMember in the designer, you need to copy the code that the designer generated, for all the properties of all the objects you want to keep, to the form_load event.
This way, when you change the grid binding, which will erase everything that was set in the designer, you can simply update this new code in form_load so it compiles again. Note that it will require a minimum of work only if your underlying DataTable still uses the same columns and columns name as before, apart from the added/deleted columns.
For the new columns, it would be best to also set them up in the form_load event, so if you ever update you DataTable again, it will require less work.
Imported from legacy forums. Posted by André (had 240 views)
Thank you André.
We are at the early stage of our project, and many things are in flux, including the table designs.
We are trying to figure out what’s the best way to use this grid:
– unbound mode and use designer to configure the columns
– bound mode, auto create columns and use the designer to configure the columns
– bound mode, use code to manually add data bound columns to the gridEach way has pros and cons, it seems. All the Xceed sample code seems to use code to manually add and configure the columns instead of using the designer. Do you think this the best way?
Thanks again.
Hao
Imported from legacy forums. Posted by hao_jiang (had 615 views)
As I stated previously, if you change your data binding, it certainly requires less work if you have done it in code.
Imported from legacy forums. Posted by André (had 3906 views)
-
AuthorPosts
- You must be logged in to reply to this topic.