I want to add a new row in ultra grid at index 0 mean at top of grid.
Hi,
Do you mean in code? Or do you want your users to be able to do this through the UI?
In code you can do something like this:
private void button1_Click(object sender, EventArgs e) { UltraGridRow row = this.ultraGrid1.DisplayLayout.Bands[0].AddNew(); row.ParentCollection.Move(row, 0); this.ultraGrid1.ActiveRowScrollRegion.ScrollRowIntoView(row); }
To enable adding for your users, just grid.DisplayLayout.Override.AllowAddNew to one of the settings that includes the word "Top", like FixedAddRowOnTop.
Hi, Sir Mike.i live in vietnam, I'm not good at english.I want to add rows in the desired position of the table. I now add a top and bottom, I do not like it
Hi nguyen,
When you insert a new row into a DataTable, the DotNet BindingManager sends a notification that a new row was added. But it does not report the correct index of the new row. So the grid just puts the row at the bottom.
The only way around this that I know of, is to call the grid.Rows.Move method and set the position of the row yourself.
Hi Nguyen,
I'm having difficulty understanding you. But it sounds like you are saying that when you update the data, it's not updating the correct row in the grid. Is that right? I can't see how that could happen. The grid row keeps a reference to the data row in the ListObject property of the row. It also has a ListIndex which is the index of the row in the data source.
My best guess is that something in your code is mis-matching the rows.
Hi sir Mike,
i have used row.ParentCollection.Move(row, i) and set value i and success in the first. But the row is changed, import data next time will bug. Total variable addressed by i. but not suitable to solve my whole. Positions need more data are key