Hello,
I am pretty sure this used to work before.
Now it throws a System.IndexOufOfRange exception, message "Index was outside the bounds of the array"
My version is 2011.1.419.1040
I am pretty sure this used to work before.
this
.radGridView.Columns[0] =
new
GridViewDataColumn();
Now it throws a System.IndexOufOfRange exception, message "Index was outside the bounds of the array"
My version is 2011.1.419.1040
4 Answers, 1 is accepted
0
Hi Ken,
The DisplayIndex property will define at which position the column will be displayed.
Regards,
Maya
the Telerik team
You need to add a column like follows:
this.RadGridView1.Columns.Add(new GridViewDataColumn(){DisplayIndex = 0});
The DisplayIndex property will define at which position the column will be displayed.
Regards,
Maya
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Andrew
Top achievements
Rank 1
answered on 02 Jun 2011, 10:14 AM
Thank you for the fast response.
DisplayIndex looks a bit weird to use, can you please tell what are the reasons behind this change?
DisplayIndex looks a bit weird to use, can you please tell what are the reasons behind this change?
0

Andrew
Top achievements
Rank 1
answered on 02 Jun 2011, 10:16 AM
I got side tracked by your answer, actually adding is not what I need. I need to replace a column.
So going back to my original question, how can I replace a column?
So going back to my original question, how can I replace a column?
0
Hello Ken,
Regards,
Maya
the Telerik team
If you want to replace a column, you may remove it first and add a new only with the exact same display index:
this.clubsGrid.Columns.RemoveAt(1);
this.clubsGrid.Columns.Add(new GridViewDataColumn() { DataMemberBinding = new Binding("Name"), DisplayIndex = 1 });
Maya
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items