Unfortunately there isn't. Dynamically created controls simply don't exist on postback due to the stateless nature of http. Since you are creating the controls after viewstate gets wired up (just before page_load), you won't get viewstate or event firing for your dynamically created controls.
You might want to fake it out with a hidden control that will store relevant information to be handled on postback. You can then populate that control with a bit of javascript. Another option would be to use the "clientside callback" facilities provided with the framework.
Edit: Read up on SQL injection and using prepared statements. You've got some problems there. Also, you might find the StringBuilder class to be useful.