I'm trying to swap 2 columns within the RadGrid ColumnCreated event (see code below). When I step through the code with the debugger, it appears to be working, but when the page renders, the columns are not swapped. I have 2 columns in the markup (update & delete links) and a number of other columns that are auto-generated. I'm trying to swap the 2nd column in the markup with the last auto-generated column. Why are the columns not swapping? TIA, Gary.
| protected void rgContacts_ColumnCreated(object sender, Telerik.Web.UI.GridColumnCreatedEventArgs e) |
| { |
| switch (e.Column.UniqueName) |
| { |
| case "PartyId": |
| case "GUID": |
| case "Code": |
| case "Type": |
| e.Column.Visible = false; |
| break; |
| case "LastColumn": |
| GridColumn gcDelete = rgContacts.MasterTableView.Columns.FindByUniqueName("DeleteCommand"); |
| if (gcDelete != null) |
| e.OwnerTableView.SwapColumns(e.Column, gcDelete); |
| e.Column.Visible = false; |
| break; |
| } |