User (Old forums)MemberMay 21, 2007 at 11:39 amPost count: 23064
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?
Imported from legacy forums. Posted by hao_jiang (had 2846 views)User (Old forums)MemberMay 21, 2007 at 3:10 pmPost count: 23064
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)User (Old forums)MemberMay 21, 2007 at 3:51 pmPost count: 23064
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 grid
Each 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?
Imported from legacy forums. Posted by hao_jiang (had 615 views)
- You must be logged in to reply to this topic.