In our project we had an issue with the RadGrid event method. The event method was not triggered although a postback did occur. Apparantly this was due to the following code:
GridBoundColumn boundColumn = new GridBoundColumn();
boundColumn.DataField = "CustomerID";
boundColumn.HeaderText = "CustomerID";
RadGrid1.MasterTableView.Columns.Add(boundColumn);
The problem was that the .DataField and .HeaderText properties were set BEFORE the GridBoundColumn object was added to the MasterTableView columns collection. According to the documentation of the RadGrid (http://www.telerik.com/help/aspnet-ajax/grdprogrammaticcreation.html): "Columns and detail table should be added to the corresponding collection first, before the values for their properties are set. This is important because no ViewState is managed for the object before it has been added to the corresponding collection.". However, this requirement is rather unorthodox and differs from other equivalent web controls. And that this would result in that event methods will not be triggered is not easy to identify. At least, the documentation should be more clear on this issue and the methods and properties should have comments regarding this requirement.
Christer Lundhag
GridBoundColumn boundColumn = new GridBoundColumn();
boundColumn.DataField = "CustomerID";
boundColumn.HeaderText = "CustomerID";
RadGrid1.MasterTableView.Columns.Add(boundColumn);
The problem was that the .DataField and .HeaderText properties were set BEFORE the GridBoundColumn object was added to the MasterTableView columns collection. According to the documentation of the RadGrid (http://www.telerik.com/help/aspnet-ajax/grdprogrammaticcreation.html): "Columns and detail table should be added to the corresponding collection first, before the values for their properties are set. This is important because no ViewState is managed for the object before it has been added to the corresponding collection.". However, this requirement is rather unorthodox and differs from other equivalent web controls. And that this would result in that event methods will not be triggered is not easy to identify. At least, the documentation should be more clear on this issue and the methods and properties should have comments regarding this requirement.
Christer Lundhag