Solved

c# how can I use a temporary table to collect and display data before writing it permanently into the database.

Posted on 2007-04-04
2
254 Views
Last Modified: 2012-05-05
I have an aspx page that conatins a gridview a dropdownlist a textbox and a button.

I use a tableadapter to bind a table to the dropdownlist.

The user selects an item from the ddl enters a value into the textbox and click the button.

Based on what the user selects and enters rows need to get added to teh table that is bound to the grid view.. So the grid view basically gets populated as the user is selecting items from the ddl and clicking the button.

Eventualy the user will click another button and the values in teh grid view will get written to a series of tables in the database.

My question is this...what is the best approach to handling the table that is bound to the gridview.

I have though about creating a programmatic table and having it be persistent while the page is active and binding it to the gridview though I havent quite worked out how to accomplish that yet.

Easier stil would be to have an empty table in teh database that I could bind to the gridview throgh a tableadapter and just write the values to that table..then at the end write those values to their legitimate tables in the database and finish up with deleting everything in this "temp" table location.

I am guessing that there is a best practice to follow in this regard..some kind of system that allows me to collect data into a "temporary table" that I can display in a gridview before finally writing that data to a database...

0
Comment
Question by:Prysson
2 Comments
 
LVL 37

Accepted Solution

by:
samtran0331 earned 500 total points
ID: 18852225
how much of this do you have working?
is this part working?:"So the grid view basically gets populated as the user is selecting items from the ddl and clicking the button."

I would use a datatable to maintain the gridview and user interaction...then work with the datatable when it's time to insert into the db...


http://msdn2.microsoft.com/en-us/library/system.data.datatable(vs.71).aspx
0
 

Author Comment

by:Prysson
ID: 18861781
My problem right now is basically trying to figure out how to bind an item template text property to a column in the datatable
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
install app on other machine 13 32
ASP.net VB.net Load contents of a GridView  to Excel 2 27
Turn on intranet settings 1 36
Reset asp.net login password 4 25
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

937 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now