Yes there are a lot of better ways to do this.
You could use a pre-built control like the
GridView control to dynamically create your table and fill it with dynamically created TextBoxes...or you could use a
Repeater control to generate your table and TextBoxes.
The important thing about both of these classes is that they both implement the
INamingContainer Interface. This interface creates a new ID namespace within a Page which means that all of the dynamic controls within the class that implements this interface will be given a unique ID within the control when rendered on the page. This unique ID is combined with the ID of the dynamic control.
It's pretty cool stuff but you don't have to go down to that level if you don't want to.
I think, going by your programming style, you'd be most interested in using the Repeater control.
Or, like semomaniz was suggesting, you could dynamically create these controls if you want to. If you're interested in doing this, please read over this short article on
how to use dynamic controls in ASP.NET before you begin or you may end up pulling your hair out in frustration with strange problems that are not apparent at first :)
-Frinny