My 10th grade English teacher Mrs. Houghton once made me stay after school for "Comma Detention" (no, I'm not kidding) because I couldn't remember all of the "5 Comma Rules" for a quiz in her class. The only comma rule that still sticks in my head from that list was #5, Do Not Use Unnecessary Commas. This has inspired me to write my own rules...
Datagrid Girl's Rules for Dynamic Controls in ASP.NET.
Rule #1) Don't create controls dynamically unless you really have to. I can't tell you how many times I've been answering Datagrid questions for people and in about the 4th message they point out, "Oh, I'm creating this grid dynamically, does that matter?" Yes, it matters. The code for working with dynamically created controls is just plain harder.
Rule #2) If what you're creating dynamically doesn't change based on any user inputs or other criteria, there's really no reason to create the thing dynamically. I've met some people who just like to create controls dynamically so all the code is in the .vb file rather than the ASPX. To me that seems just plain silly. The whole point of codebehind .vb vs. ASPX is to have separation of presentation and code, so if you're creating your presentation in code, you're missing the point. (There are exception to this however, when you do need to do presentation stuff in code, but those should be just that--exceptions).
Rule #3) If what you're creating dynamically repeats based on some kind of loop, either from a database, an array, the file system, or similar, again you don't need to use dynamic controls. This is where a Repeater comes in handy. You can use a Repeater to repeat just about anything, including repeating a Datagrid for every row in a database table, for example.
Rule #4) If you do create dynamically, don't expect that control to exist after postback. If your situation doesn't apply to rules 1-3 and you do have to use dynamic controls, you must recreate them after each postback if you expect to A) read a value from it or B) have it fire an event.
Rule #5) Do not use unneccessary dynamic controls. (Sorry, couldn't resist).
Datagrid Girl