Question Creating Multiple Dynamic TextBox n storing the value in mssql

lingers07

New member
Joined
Jan 8, 2021
Messages
1
Programming Experience
3-5
Please help me with the code to create Dynamic TextBox in ASP.NET and store data to SQL Server using button click. Every time a user enters x number of textbox inside the Textbox field and click on the button,it will generate the stated x numbers of row with three individual Textbox and another button will save the value to database.

Example: x = 4

[ TextBox1 ] [TextBox2] [TextBox3] |New Row|
[ TextBox4 ] [TextBox5] [TextBox6] |New Row|
[ TextBox7 ] [TextBox6] [TextBox9] |New Row
| [ TextBox10 ] [TextBox11] [TextBox12] |New Row|


|Save|
 
Seems like a data grid would be more appropriate.

Anyway, is there a particular reason why you are they are trying to do this with WebForms rather than some framework that is more current?
 
Last edited:
If you do want to go that way then you need to put in a bit of research and effort for yourself and let us know where you're actually stuck. You've basically told us what you want to do and expected us to provide everything. Creating controls dynamically has nothing at all to do with saving data to databases so why are you even worrying about the latter before you work out how to do the former?

One of the biggest reasons that beginners can't solve problems is that the problems they try to solve are too big. There are at least three problems in what you just asked and you should be solving each one separately. The first is how to create controls at run time. If you research that, I find it hard to believe that you wouldn't find plenty of useful information. The research is easier if you're not obfuscating the actual problem with irrelevant stuff that is part of separate problems. Once you know how to create the controls, then you can work out how to get data from them on a postback. Once you can get the data from the controls, then you can research how to save data to a database, which has exactly zero to do with any controls or even Web Forms. Data is data and saving it to a database is the same no matter where it comes from.

This is not specific to programming either. This is problem-solving 101: divide and conquer. Break the initial problem down into parts, solve each part separately and then combine the solutions. We will be willing and even eager to help if an wehn you encounter an actual issue, i.e. you learn how to do something and try to do it but it doesn't work. If you just say "I want to do X, tell me how" then you'll find us less enthusiastic.
 
Back
Top Bottom