You can do it using ViewState just like how Srikanth described or you could use simple user specific singleton approach to ensure your data persist in class and keep using the same object, This will be faster and efficient as it will save lot of boxing unboxing
Interviews3 answers
How to add temp data to GridView and after inserting multiple temp entries, how to finally save all the entries in the database in an ASP.NET Web application.
3 Answers
Ishoo AnyalPosted Sep 27, 2019, 3:04 AM EDT
Yes , You can add temp data to list and bind data to gridview. then if want to data insert into database then you can add data in database using simple linq query
Ketan ShindePosted Nov 20, 2018, 11:46 PM EST
Take a DataTable and store in viewstate. Then add data in the gridview from the datatable. If you are inserting new record, Then add that record into the datatable which is present in viewstate and bind that dt to the gridview.
Sreekanth ReddyPosted Oct 26, 2018, 3:55 AM EDT

