Solved

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

Posted on 2009-04-10
4
198 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now