Hi I am trying to insert a row in a databound grid at a specific index. I tried this in the following way:
private void HierarchyGrid_Load(object sender, EventArgs e)
{ BindingList<Pool> data = DummyDataBuilder.BuildDummyData(); TestGridMain.DataSource = data; TestGridMain.DataBind(); InsertSpecificRow(); } private void InsertSpecificRow() { var position =0; var row = TestGridMain.DisplayLayout.Bands[1].AddNew(); row.Cells["Name"].SetValue("Bla bla bla", false); row.Appearance.BackColor = Color.Pink; TestGridMain.Rows.Move(row, position); }
{
BindingList<Pool> data = DummyDataBuilder.BuildDummyData();
TestGridMain.DataSource = data;
TestGridMain.DataBind();
InsertSpecificRow();
}
private void InsertSpecificRow()
var position =0;
var row = TestGridMain.DisplayLayout.Bands[1].AddNew();
row.Cells["Name"].SetValue("Bla bla bla", false);
row.Appearance.BackColor = Color.Pink;
TestGridMain.Rows.Move(row, position);
Now whatever value I give position, the row is always at the bottom. I even added a button to the form invoking the Rows.Move on a specific row and I checked the row's index before and after the move instruction: no change.
Is there a setting in the grid that is preventing my rows from moving? Did I miss something elsewhere?
Thanks,
Teun
P.S. Sorry for ugly code: What is the correct way for mark up?
Hi,
I tried this out and it worked fine for me on the root level. Your code seems to be doing this on a child band, but I can't see why that would make any difference.
I am, of course, using the latest service release, so maybe this is a bug in the version you are using that has already been fixed.Try getting the latest service release and see if that helps.
How to get the latest service release - Infragistics Community
If not, perhaps you could post a small sample project demonstrating the issue so we can check it out.
Teun said:P.S. Sorry for ugly code: What is the correct way for mark up?
You can use a code tag.
I have the version from 17-09-2010 (NetAdvantage 2010 vol2). I am currently evaluating. Acceptance depends on me being able to get the UltraGrid to comply with certain unusual requirements.
I have quickly made a sample project which illustrates the problem: Check out the button at the bottom of the form, AFAIK it should move the new row up 2 rows every time it is pressed... on my computer it doesn't. I've tried several values for the target index.
I hope you can help me out.
About code tag: It looks worse now lol