?
Solved

How do you refresh a page in codebehind

Posted on 2011-10-19
3
Medium Priority
?
244 Views
Last Modified: 2012-05-12
PageA has a repeater which displays some number of rows from a table. After the repeater on PageA I have a textbox and an "Add" button. I enter some text into  the textbox and click on the "Add" button. In the codebehind for the "Add" button I insert the data from the textbox into the table used by the repeater and then I open PageB which displays the detail information. At some point in the codebehind for the "Add" button I need to refresh PageA so that the new information I inserted into the table is displayed by the repeater and then go to PageB.

My code in the Add button is:

Response.Redirect(Request.RawURL)

ClientScript.RegisterStartupScript(Me.GetType, "popup", "window.open('CustomerDetailForm.aspx?Cust_Code=" + strCustCode + "','_blank','menubar=no')", True)

Whatever is first in the code above happens but not the second.

How do I refresh PageA and also get to PageB?
0
Comment
Question by:Donna Kainer
3 Comments
 
LVL 20

Accepted Solution

by:
ddayx10 earned 500 total points
ID: 36996422
As soon as you do the response.redirect your code is done... nothing after that will happen because you are now "reloading" the page.

To get the repeater refreshed on pageA you probably want to rebind it to it's datasource instead of refreshing the page.

ex. repeater.databind()

I can't really comment much on the pageB issue. It seems like you are saying this is already working for you excepting that the redirect is currently stopping it from functioning. There are several ways you may or may be going about this and its just not feasible to comment on that at this time.

You would need to change the code from a registerstartupscript to registerclientscriptblock for it to function without the "reload".

So instead of:

response.redirect
registerstartupscript

Go with:
repeater.databind
registerclientscriptblock
0
 

Author Closing Comment

by:Donna Kainer
ID: 36999556
This is exactly what I needed. It is so simple I don't know why I did not think of it myself.

There is not a problem with pageB. I only included it so that the whole picture could be seen. Thanks.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Integration Management Part 2
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

839 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