AspAlliance.com LogoASPAlliance: Articles, reviews, and samples for .NET Developers
URL:
http://aspalliance.com/articleViewer.aspx?aId=627&pId=-1
CodeSnip: Refreshing a Parent Page from a Popup Page in VB.NET
page
by Sameer Lal
Feedback
Average Rating: 
Views (Total / Last 10 Days): 16845/ 12

The following is an example of one way to refresh the parent page from a child popup.  First off, you can add the following code on a button of the parent page to send the ID value as a cookie to the popup child page.

Response.Cookies ("ID").Value = TextBox1.Text
Dim sScript As String
sScript = "<script>window.open ('SurveyResults.aspx','','height=300, 
width=300, scrollbars=no') ;< /script>"
Response.Write (sScript)


This will open up SurveyResults.aspx page as a popup child page.  Then add the following code on the Page.Load event of SurveyResults.aspx page (the popup child page).
Private Sub Page_Load(ByVal sender As System. Object, ByVal e As System.EventArgs) 
Handles MyBase.Load
  'Put user code to initialize the page here
  If Not Page.IsPostBack Then
    Dim IDGet As Integer
    IDGet = Request.Cookies("ID").Value
     //with this IDGet, run the command and fill ds or whatever and then//
     Dim cScript As String
    cScript = "<script language='javascript'> opener.location.href = 'Survey.aspx'; </script>"
    RegisterStartupScript("parentwindow", cScript)
  End If
End Sub

To close the popup child page, you can have a button on SurveyResults.aspx page to add the following code.

Private Sub btClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 
Handles btClose.Click
  Response.Write("<script>window.close();</script>")
End Sub

That is all there is to it. I hope you will find this helpful.


Product Spotlight
Product Spotlight 

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-19 9:55:25 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search