Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Referring to a control on a seperate page.

Status
Not open for further replies.

primagic

IS-IT--Management
Jul 24, 2008
476
GB
I have a pop up window which allows the user to add a item to the database.

After the item has been added, I want to refresh the main page with the new item. Can I refer to the control on the main page that needs refreshed from the popup page?

Thanks

 
Do you want to trigger a postback so that code runs and items are returned from the database?
if so do something like this:
Code:
this codes in the HTML of your page
function myRefresh()
{
   //Writes out the __doPostback call to the page.  This is called when the pop-up window is closed to refresh the screen.
   //The pop-up window calls this function, which in turn calls the Click event of the btnHiddenRefresh button.
   // __doPostBack('thisPage:btnHiddenRefresh','');
   <%=strRefresh %>;
}

 <asp:Button ID="btnHiddenRefresh" runat="server" />

Code:
In the code behind:
'Global variable
Public strRefresh As String

  Protected Sub btnHiddenRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHiddenRefresh.Click
        'This is a hidden button.  The click event is fired when the pop-up window is closed.
        '//The pop-up window calls the JS MyRefresh() function, which in turn calles this through the __doPostBack() call.
         '' Do your database call here and refresh the conrol.
    End Sub
If you already have code set up to do the database call and refresh, use that above instead of creating a new button
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top