I have setup a DataGrid with a number of columns and a checkbox and column at the end of the row.
I am also changing the layout of the datagrid on the OnItemCreated event which changes the layout of the datagrid by expanding the rows with the "Rowspan" attribute and remove the extra columns and controls where they are no longer required.
The original datagrid layout was setup like this:
___________________________________________
| 1 | Employee Name | 01/08/10 |[] |[SAVE]|
| 1 | Employee Name | 02/08/10 |[] |[SAVE]|
___________________________________________
| 2 | Employee Name | 01/08/10 |[] |[SAVE]|
___________________________________________
| 3 | Employee Name | 04/08/10 |[] |[SAVE]|
| 3 | Employee Name | 05/08/10 |[] |[SAVE]|
| 3 | Employee Name | 06/08/10 |[] |[SAVE]|
___________________________________________
| 4 | Employee Name | 03/08/10 |[] |[SAVE]|
___________________________________________
And now it looks like this with the rows expanded, the controls removed and the dtagrid columns deleted...
___________________________________________
| 1 | Employee Name | 01/08/10 |[] |[SAVE]|
| | | 02/08/10 | | |
___________________________________________
| 2 | Employee Name | 01/08/10 |[] |[SAVE]|
___________________________________________
| 3 | Employee Name | 04/08/10 |[] |[SAVE]|
| | | 05/08/10 | | |
| | | 06/08/10 | | |
___________________________________________
| 4 | Employee Name | 03/08/10 |[] |[SAVE]|
___________________________________________
The page displays when opened, and the paging control works as expected each time a user clicks on a page number.
However, when I click on the [SAVE] button for a particular employee, an error message shows a message similar "Invalid Postback or Callback". I understand that this is a result of the controls and columns that I have removed in the datagrid and the event validation does not match the orignal rendered items.
I do not want to remove the EnableEventValidation because it is a security issue.
I know I have to use the Render method to fix any changes that I have made before the page is displayed, but how do I resolve this postback issue?