How do you refresh a page in codebehind

Posted on 2011-10-19
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:


ClientScript.RegisterStartupScript(Me.GetType, "popup", "'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?
Question by:Donna Kainer
    LVL 20

    Accepted Solution

    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:


    Go with:

    Author Closing Comment

    by:Donna Kainer
    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.
    LVL 7

    Expert Comment


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    755 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

    19 Experts available now in Live!

    Get 1:1 Help Now