❔ ASP.NET Dynamic input controls
Hello! I'm currently learning ASP.NET web development, having experience with web development using the MERN stack, and I'm struggling to wrap my head around doing so much server-sided work. Specifically right now I'm trying to create a dynamic table containing input fields in the code behind such that the user can add and remove rows, and eventually submit their inputs. I've achieved the basic functionality of adding and removing rows, however I can't seem to understand how to persist the user input in these dynamically-created rows while adding and removing them. I'm entirely open to recreating this from scratch as I've likely done it terribly inefficiently.
All solutions I've thought about and tried so far just seem so impractical compared to basic client-side jquery/js
Any help is appreciated, thanks!
5 Replies
Easiest way would be sending the form with JS, as Json, and receiving it in an API endpoint
Quick and dirty example
Send
Boom
Sorry, I'm not really understanding, and even if I did I'm not sure where that code would go 😅 Might be important to note that I'm working with ASP Web Forms
Just to provide a little more context, this small project is for an internship and they REALLY haven't taught me much at all, so far all I've really done is create a few basic pages / forms with communication to a MSSQL db and some session storage stuff, only really working with the .aspx, .aspx.cs, and some .cs files
A oof ouch owie webforms
Won't be able to help with that, I'm no archaeologist
LOL no problem, thank you
the more i work with this the more I feel that ASP web forms are NOT DE WAY
So i got it to work... very jankily... i noticed on postback that the Request will always contain form input values even from the dynamically added controls so I grab all of those (for loop adding them to a list with Request.Form.Get()), and manually set the value of each input with
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.