If, you find yourself in the unfortunate position of having a dynamically created
Gridview control in your ASP.NET page AND needing to handle the
SelectedIndexChanged event… as I was, you may find yourself banging your head against the monitor trying to understand why the event isn't getting fired.
Well, dear reader, that's because you didn't set the
Gridview.ID property, and when the callback for the event is fired, it does that by ID/parameters. The parameters are there, but the ID isn’t. So it can't find your control, therefore it can't fire the event.
So, always assign the ID of dynamically generated ASP.NET controls!