Insert and AddAt methods unexpected behavior

2 posts, 0 answers
  1. EmpowerIT
    EmpowerIT avatar
    117 posts
    Member since:
    Jun 2007

    Posted 19 Jul 2010 Link to this post

    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
  2. Mira
    Mira avatar
    1124 posts

    Posted 22 Jul 2010 Link to this post


    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.

    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
  3. DevCraft R3 2016 release webinar banner
Back to Top