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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

825 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