Microsoft promoting anti-patterns
Found this today in production code that I needed to modify:
… = ((TextBox)(row.Cells.Controls)).Text; … = ((TextBox)(row.Cells.Controls)).Text; … = ((CheckBox)(row.Cells.Controls)).Checked;
This was in a GridView.RowUpdating handler, and the change that I needed to make was adding a couple of columns to that grid.
Of course, I refactored the code in that page, and, of course, I found that all pages in the project are copy-paste-contaminated by that terrible pattern.
I did some lurking on google for grid view “best practices” and found something that is likely the origin of the infection: