.net Multiple Row Form Fields Data Entry

Hi Experts,

Is there a way in .NET to create a grid of fields (including dropdowns, text, radios etc.) where a user can enter multiple rows at once, and submit the whole grid? DataGrid?

Who is Participating?
Dustin SaundersConnect With a Mentor Director of OperationsCommented:
Since each of your 'parent' user controls is a separate object-- the 'child' controls on that are unique to each object.  So, say you load your data into a DataTable.  Then for each row, you create one of your custom controls (with all the drop downs, radios, etc.) and set each of the control's values.  Then add those controls onto a panel as you iterate through them.  Now you've got your set up, so when the time comes to wrap to commit the changes, you can iterate through each control on the panel to write back the values.

You'll need to either make the controls on the 'parent' public, or set public variables that you call (like ControlName.FirstName).  

I usually create a class for my control (with all the variables I need { get; set; })  and then pass that class on to the control when I create it.  Then on the load() event for the control, that's where I set the individual control values on the 'child' objects.  If you create a public class variable for each form, then save the changes to the class it makes it easier to write back.
Dustin SaundersDirector of OperationsCommented:
You can create a user control with each of the items on it, and then populate your form with those controls.  Then, when you submit the changes, you can go through each control and get the values like you would with a data grid.
tablaFreakAuthor Commented:
Thanks, Dustin. And .NET doesn't choke on multiple form fields with the same name, or does the runtime engine dynamically create different field names for those controls?
tablaFreakAuthor Commented:
Thanks for the help, Dustin.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.