Solved

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

Posted on 2009-04-10
4
201 Views
Last Modified: 2012-06-22
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.
0
Comment
Question by:osmendez
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
Haris V earned 500 total points
ID: 24119007
0
 

Author Comment

by:osmendez
ID: 24119248
Thank you Sirah, I just figured it out with your first link.
0
 

Expert Comment

by:samgiuoco
ID: 24119286
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.
0
 

Author Comment

by:osmendez
ID: 24120533
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!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

679 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