I had problems with my custom field generator. If I put this line of code
GridView1.ColumnsGenerator = new FieldGenerator(table, true);
in page_init event, I get no errors, but event GenerateFields never fires.
Then I found answer on this forum, that I have to move this line of code to Page_Load event, but now I ger this error, when I am selecting rows in gridview.
Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
View Complete Post