Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

.net Multiple Row Form Fields Data Entry

Posted on 2016-11-16
4
Medium Priority
?
48 Views
Last Modified: 2016-11-16
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?

Thanks
Steve
0
Comment
Question by:tablaFreak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 13

Expert Comment

by:Dustin Saunders
ID: 41890315
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.
0
 

Author Comment

by:tablaFreak
ID: 41890342
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?
0
 
LVL 13

Accepted Solution

by:
Dustin Saunders earned 2000 total points
ID: 41890361
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.
0
 

Author Closing Comment

by:tablaFreak
ID: 41890476
Thanks for the help, Dustin.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question