Link to home
Start Free TrialLog in
Avatar of AlHal2
AlHal2Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Can gridview retain it's data after postback

This question is based on https://www.experts-exchange.com/questions/28373722/Updating-a-gridview-from-different-sources.html

I press a button to populate a gridview.  When I press the button again with different parameters, I want the new results to be added as an extra row to the gridview.  I don't want the new results to replace the old.

The gridview is populated by passing parameters to a stored procedure.  Obviously only one set of parameters can be passed at a time.

I'm using vb2008 with asp.net 3.5
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

What are you using for the data source for the GridView?  If you are using something like the SqlDataSource, then it gets to be challenging.  If you are binding to a list structure or DataTable, then it should be easier.
Avatar of AlHal2

ASKER

I think I've solved the problem.
I've had a table created which will store the data that gets sent to the gridview.  The stored procedure updates the table and then runs a select query which is sent to the gridview.
What are you doing with the table when the page posts back?
ASKER CERTIFIED SOLUTION
Avatar of AlHal2
AlHal2
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AlHal2

ASKER

It works.