Well, like I said this is not exactly the easiest thing to do (the first time anyways) because there are a lot of things that you have to keep in mind when you implement this.
The first thing I suggest you do is read over this quick overview on
how to use dynamic controls in ASP.NET.
The important thing to take from this is that if you want to be able to retrieve Text from your dynamic TextBoxes...or if you want to be able to handle an Event that some control raised...you need to instantiate the dynamic controls in the Page_Init event.
In your case you are going to be dynamically adding TemplateFields ("columns") to your GridView in the Page_Init event....so you need to know how many columns you need to add.
The Page_Init event occurs very early in the life cycle. You don't have a lot of things available to you at that time so be aware that things like "IsPostback" won't work properly. This is because, things like "IsPostback" are initialized after the ViewState for the page is loaded, and the Page_Init event occurs
just before the ViewState is loaded. You can still use things like Session or access cookies or use the query string at this point though. The whole reason why it's important that your instantiate your dynamic controls in the Page_Init is so that the objects exist when the ViewState is loaded...in other words if your TextBoxes don't exist when the ViewState is loaded for them, then your TextBoxes will not contain any Text (which may be loaded from the ViewState).
Ok, now that that very important point has been covered, I recommend that you look over the
ITemplate Interface. This interface lets you define a class that will you can use as the TemplateField. You will have to create a custom "TemplateField" class and in there add your TextBoxes to the class.
You should probably also look at the
INamingContainer Interface so that you get a good idea of what's going on in general (you should probably read this first actually).
Both of these topics might take you a while to go through.
Like I said this is not exactly easy to do the first time round because there is a lot of new topics and concepts to grasp before you will get a working solution.
-Frinny