Our website uses RadGrids that are created entirely in code-behind, because each grid's columns are controllable by the user. The user is allowed to add and remove columns as well as move columns around. I used the following articles as the basis for the page architecture:
The grid is created dynamically, and added to a placeholder control that is defined on the page. In addition, the columns are created dynamically, in the OnInit method of the page.
As a side note:
In the first article referenced above, it states that if you are creating the grid entirely in code-behind: "No ViewState is required for grid structure to be persisted as it is recreated on each page initialization
". However, this is not entirely true, because if you allow sorting, and if viewstate is disabled, you cannot click on the sort icon to affect a sort.
Regardless of whether the grid's viewstate is enabled or not, the problem arises when I sort a column, and then delete the sorted column. When I delete the sorted column, I get the following error:
Sys.WebForms.PageRequestManagerServerErrorException: An error has occurred because a control with id 'ctl00$ContentPlaceHolderMain$ItemView1$grid1$ctl00$ctl02$ctl01$ctl09' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error.
The id of the offending control might be different each time, but when I look at the HTML, it always corresponds to the <input type="image"> tag that represents the sort icon (the up/down arrow). This input tag has a name attribute that matches the control name in the error message, but it has no ID attribute. I don't know if this is the reason for the error or not. I also get the above error when adding a column, and moving that column to a position to the left of the sorted column.
In any case, I am having a difficult time creating a small test project that duplicates the behavior. In the meantime, I was wondering if Telerik or anybody has encountered this problem and hopefully found a solution.
Thanks for any help!