.Net Dynamically Adding Controls

Chameleoki

Limp Gawd
Joined
Jun 28, 2004
Messages
479
Okay, here's my issue. I'm an intermediate programmer but have come upon a situation that I could use some input from some better programmers.

I am building an web-based inventory application in VB.Net (.Net 2.0). I need to build a form that will ask for a count of the inventory. Here is where it gets tricky. There will be different inventory items for different people. There might be up to 200 items. Each item might have different quantities (i.e. how many cases, jars, and oz do you have?)

I'm thinking the only way to do this is to dynamically add the controls to the form. I'm thinking of having a hidden field with the current amount and only updating if there is a difference in quanties from what they entered and the database to save round trips.

With 200 items x 2 or 3 quantities on a webpage, this seems like it's asking for trouble. I guess I will need to break it up into sections or groups but I'm just wondering if anyone has a magic bullet that I might be missing!

Thanks!
 
You have at least 3 options available, with a LOT of other options depending on how much filtering you can get the user to do to make your life easier. Also, you didn't state what type of database you are using, although with .NET it doesn't really matter. Where necessary, my ideas will assume that Microsoft SQL Server is utilized:

1) Display a ListView with the title/identifier for each. When the record is selected display the details in a common area for editing/deletion/whatever.

2) Same as #1, but use a TreeView and organize the data in a 2-deep or 3-deep tree, depending on what type of pre-sorting you can do on the user's behalf.

3) Utilize ADO.NET and use a disconnected data access model. Look up SqlConnection, SqlCommand, SqlDataAdapter, DataSet and DataTable. Most of what you are looking for can be found in the System.Data and System.Data.SqlClient namespaces, so definitely search the MSDN for that (or search for what you want.) Here's a link to something that can help you get started, assuming that the information is ideal for your purpose.

202276
 
Thanks, that does give me some ideas as far as the database updating goes. It is SQL Server. I have done and am very familiar in updating with those items.

I guess my main question is they WILL have to fill out every item field, not just choosing which ones have changed. Keeping 200+ dynamic controls straight seems like busy work but I haven't found a better solution.

If I have them fill out one item per page, they will have to page A LOT (200 times). If I don't divide it up, then there's 200+ textboxes for them to fill out. I just worry about the postback size in that situation.

Is there a way after each field is filled out that it just posts that data for that field without refreshing? I'm not sure I know enough about AJAX and JS to do that.
 
Back
Top