I am using winForms version 10.1.
I have an ultraGrid on my form, which I've manually defined 3 bands, each containing a few columns.
I am building a dataset that matches the structure of the bands. Each datatable in the dataset is related properly. However, only the first table in the dataset actually contains any rows. The child tables are initialized but cointain no rows at this point.
I bind to the grid using the SetDataBinding() method, so any columns not defined in the bands shouldn't display. After the initial load, the first band displays properly. In other words, the columns I defined in the band display correctly, and other columns are hidden as desired. We're good so far.
Now when I click the "+" button to expand the parent band, I want to dynamically fetch the band's child rows. This is done in the grid's BeforeRowExpanded event. In this event, I go back to the dataset, adding new rows to the child table associated with the corresponding child band. This properly occurs, and I get rows in the child band after the event fires.
Problem: The child band now has new columns that I didn't want to show up! Remember that I defined the bands manually, so I wanted only a few of the columns to show up, not all of them.
What can I do to ensure that my schema definition is honored while adding rows dynamically to my dataset?
ok, i've found the solution in case anyone is interested.
The band names are significant here. The names of your bands must match your dataset.tables.tableNames exactly. Not only this, but your DataRelations' names must also match the band name.
Syncing up these names solves the issue.
Well, you can still add them as hidden, but if you want full control and get your columns added automatically, you can create a BindingSource with the type of your table row, so you'll get all columns added in the designer file. In you cs file or in the grid designer you can have full control on your columns.
Thanks for your reply.
I defined the bands manually because I need complete control over the columns that are displayed, their captions, placement, etc.
Since I am using a dataset to populate the grid, I am not able to decorate any properties with a browseable attribute.
Add them as hidden columns or add [Browsable(false)] above the property (if you can). Why did you define the bands manually?