Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
230
Adding rows to child bands dynamically autogenerates new columns!
posted

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?

Parents
No Data
Reply
  • 230
    Verified Answer
    posted

    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.

Children
No Data