Link to home
Start Free TrialLog in
Avatar of osmendez
osmendez

asked on

Using ASP.NET 2.0 how to refresh a GridView when a second page triggers some event

Hi, I need to develop a small program that allows the user to create a backorder of items. I would like to use GridView for showing the items as they can be as many as they like.

Every item can have one product code and the user should lookup into a stored procedure to let him chose the item after a filtering process as we have thousands of record of items and I need to show the results paged.

Now, my question since I am really newbie to asp.net is, which should be the fastest way to this approach. I think opening a second page where the user could select the item would do, but then how should I refresh my Gridview when the second page is closed?

Any advice would do. Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Haris V
Haris V
Flag of India 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 osmendez
osmendez

ASKER

Thank you Sirah, I just figured it out with your first link.
You could store a datatable for these backorder items in a Session variable.

Datatable tblBackorder = new Datatable();
... set up the table...
   Session["backorder"] = tblBackorder;


Then you could navigate to other pages to browse items and add rows to the table.

Datatable tblBackorder = (Datatable)Session["backorder"];
... add items ...
 Session["backorder"] = tblBackorder;

Then go back to your Grid page, get the table from Session and databind it.
The items you were browsing on other pages will appear even if the page was in a new window.
If it is in a seperate window, however, you need to address the added complication of refreshing the Grid page.
Thanks for your prompt answer Samqiuoco, at the end I dediced to leave both Grids on the same page. It was a pain in the ass for me to fire the DataBind() method from a child window.

I'm sure this is possible but I don't have any clue on how to do it. Anyway, you session variable holding the datatable is great!