This is a migrated thread and some comments may be shown as answers.

Insert and AddAt methods unexpected behavior

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
EmpowerIT
Top achievements
Rank 2
EmpowerIT asked on 20 Jul 2010, 04:49 AM
What is the expected behavior of the RadGrid.MasterTableView.Columns.Insert and RadGrid.MasterTableView.Columns.AddAt methods?

It seems to be replacing the column at the index position I specify, instead of inserting the column and shifting everything else in the collection across.

GridColumn employeeRateCol = RadGridSummary.MasterTableView.Columns.FindByUniqueName("EmployeeRate");
GridDropDownColumn rateType = new GridDropDownColumn();
int index = RadGridSummary.MasterTableView.Columns.IndexOf(employeeRateCol);
RadGridSummary.MasterTableView.Columns.Insert(index, rateType);


If i use the Add method, everything works as expected, but I don't want this dynmaically created column to appear as the last column

I am using the .NET 4 version of the Q1 2010 release

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 22 Jul 2010, 12:48 PM
Hello,

Please note that when changing the grid structure dynamically, you must ensure that the entire grid is modified on Page_Init and the EnableColumnViewState property is set to False.
For additional information, please take a look at the Changing the grid structure dynamically on postback help topic.

I have made a sample project for you demonstrating that the Insert and AddAt methods work as expected when the above mentioned requirements are met. You can find it attached to this message.

I hope this helps.

Greetings,
Mira
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
Tags
Grid
Asked by
EmpowerIT
Top achievements
Rank 2
Answers by
Mira
Telerik team
Share this question
or