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
248 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 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

19 Experts available now in Live!

Get 1:1 Help Now