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
249
Insert Row at specific index
posted

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);

 }

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?

Parents
No Data
Reply
  • 469350
    Offline posted

    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.

Children