ckay
ckay

Reputation: 66

telerik radgridview winforms order programmatically added columns

I set up a RadGridView and setup 2 Columns at Design Time and then added some GridViewComboBoxColumns programmatically. Now I want to reorder the columns, so that the first 2 columns are at the end.

I tried:

private void Grid_Standort_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
        {
            Grid_Standort.Columns.Move(0, 5);
            Grid_Standort.Columns.Move(1, 6);
            Grid_Standort.Columns.Move(2, 0);
            Grid_Standort.Columns.Move(3, 1);
            Grid_Standort.Columns.Move(4, 2);
            Grid_Standort.Columns.Move(5, 3);
            Grid_Standort.Columns.Move(6, 4);
        }

But that doesn't change anything.

Upvotes: 1

Views: 1406

Answers (1)

checho
checho

Reputation: 3120

  1. Instead in the DataBindingComplete, execute this code on a simple button click and see if it works.
  2. If it works, you can see if the DataBindingComplete event is fired at all.
  3. If it is, then you need to move the code in a later event e.g. Form.Shown

Lastly, you can try the Insert method of the Columns collection:

radGridView1.Columns.Insert(index, column);

Upvotes: 1

Related Questions