Hi,
Is there a way to prevent a newly-added row from becoming the active row when it is added to a band in the grid?
I have 2 bands in my grid, and it is populated through code (no add buttons on the grid).
If I close the parent band and then add a new row to the child band, it expands the parent band to show the child band. Is there a way to prevent this?
Thanks,
~Karen
Hi Karen,
Are you adding the rows in the grid or adding them to the data source? I suspect you might need to add the row to the Data Source rather than to the grid directly.
Everything in our project is being added directly to the grid, not through the data source. We have an UltraDataSource defined, but it is just used to lay out the columns in the grid. I really haven't dealt with the datasource. We fill the grid based on our own object model. Is this a completely inappropriate way to use the grid?
How do I add rows to the data source rather than directly to the grid? Nothing's jumping out at me in the datasource's intellisense.
I have the opposite problem. I'm using a BindingNavigator with UltraGrid bound to a datasource. When I click the BindingNavigator's "Add" button, a new row is added, the grid scrolls to the last record, but the highlighted, newly added row is not actually the grid's active row. How do I make the newly added row the grid's active row? I want to do this:
private void navAddNew_Click(object sender, EventArgs e) { ultraGrid.ActiveCell = ultraGrid.ActiveRow.Cells["TransactionID"]; ultraGrid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false, false); }
However, the highlighted, new row is not the active row.
kcrab2000 said:Everything in our project is being added directly to the grid, not through the data source. We have an UltraDataSource defined, but it is just used to lay out the columns in the grid. I really haven't dealt with the datasource. We fill the grid based on our own object model. Is this a completely inappropriate way to use the grid?
I'm not really clear on what you mean by this, so it's hard to say if it's "inappropriate". It sounds like you are just using the grid to display essentially unbound data and are therefore using the UltraDataSource as your grid's data source. If that's the case, there's certainly nothing wrong with that - that's what UltraDataSource is for. :)
kcrab2000 said:How do I add rows to the data source rather than directly to the grid? Nothing's jumping out at me in the datasource's intellisense.
To add a row to the UltraDataSource, you have to use the Add method on the Rows collection. For a root-level row, this is pretty easy:
this.ultraDataSource1.Rows.Add(...);
For a child row, you have to get the parent row and use the GetChildRows method to get the collection of child rows.
this.ultraDataSource1.Rows[0].GetChildRows("My Child Band").Add(...);