Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 My Javascript is just plain wrong :)

Author  Topic 

jhermiz

3564 Posts

Posted - 2005-01-19 : 13:57:37
So I seem to always have problems with JS....maybe it doesn't like me :). Either way here is what I'm trying to do...
First picture this..you are looking on a main application over the net. You click a button and it opens a pop up on top of the main application. I do some work on this popup (entering some data)
I click save and here is what I am having problems doing...

I want to be able to refresh the page (the main application) screen after the save of this popup. But I dont know how to do it so that it refreshes the main app that is in its own browser window. If I try to refresh it in the popup it opens that page in the popup :(...not good I know.

Can anyone lend me a quick hand?

Thanks,
Jon



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]

DustinMichaels
Constraint Violating Yak Guru

464 Posts

Posted - 2005-01-19 : 14:15:37
Have your tried using opener.location.reload(true) inside of your popup?

Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2005-01-19 : 15:09:38
It might be windowname.refresh(), but I think Dustin's suggestion is the one that's going to work.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-01-20 : 06:39:36
put the "parent.refresh(); self.close()" in the child window. this should refresh, then close the window.
if parent.refresh() doesn't work try window.opener.refresh()

Go with the flow & have fun! Else fight the flow
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-01-20 : 08:20:25
quote:
Originally posted by spirit1

put the "parent.refresh(); self.close()" in the child window. this should refresh, then close the window.
if parent.refresh() doesn't work try window.opener.refresh()

Go with the flow & have fun! Else fight the flow



I have tried everything the form simply sits there no matter what I do...I even tried debugging it and it simply does nothing...I mean my save procedure goes through but the form just sits there.

Here is the code if it helps:


Private Sub ibSave_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ibSave.Click
'function to insert a document
Dim lngDocumentationID As Long

'first validate it
If IsValid Then
'check if its a new document
If Len(Me.lblDocumentationID.Text) = 0 Then
'new document
lngDocumentationID = InsertDocumentation()
'did the insert happen?
If lngDocumentationID > 0 Then
'good insert of document
'now we check if any items exist
'in the wbs cost unit
Me.lblDocumentationID.Text = CType(lngDocumentationID, String)
Me.lblMessage.Text = "Doc. saved."
Me.lblMessage.ForeColor = Color.Green

'now we need to send the task...
If Request("sendtask") = "y" Then
Dim strUrl As String
Dim strName As String
Dim strAtt As String

strUrl = "createoutlooktask.asp?actionid=" & Request("actionitemid")
strName = "CreateOutlookTask"
strAtt = "resizable=no,top=100,left=100,width=300,height=150"

Response.Write("<script language='JavaScript'>")
Response.Write("x=window.open('" & strUrl & "', '" & strName & "','" & strAtt & "');")
Response.Write("</script>")
CloseForm()
Else
'do nothing
Response.Write("<script language='JavaScript'>")
Response.Write("parent.refresh();self.close();")
Response.Write("</script>")
End If
Else
'error occured...
Me.lblMessage.Visible = True
Me.lblMessage.Text = "Cannot save!"
Me.lblMessage.ForeColor = Color.Red
End If
Else
'it's a save
UpdateDocumentation(CLng(Me.lblDocumentationID.Text))
Me.lblMessage.Visible = True
Me.lblMessage.Text = "Doc. saved."
Me.lblMessage.ForeColor = Color.Green
CloseForm()
End If
Else
'page is not valid...
Me.lblMessage.Visible = True
Me.lblMessage.Text = "Enter Req. Fields!"
Me.lblMessage.ForeColor = Color.Red
End If 'end if page is valid
End Sub





Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-01-20 : 08:40:56
Could the main window not be refreshing because this popup is open from a user control?

For instance...you have a main page..in the center is a user control. Within the user control is a save button where this popup opens up. So when I click save inside of the user control it opens the popup. Maybe window.opener.refresh is refering to the user control rather than the main page?

I just wonder if it is that ?


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-01-20 : 08:51:38
so why don't you check the value of parent.location in the child widow.
<script language=javascript>
document.writeln(parent.location);
</script>
in the popup.

ahve you tried window.parent.parent?

Go with the flow & have fun! Else fight the flow
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-01-20 : 20:05:19
quote:
Originally posted by spirit1

so why don't you check the value of parent.location in the child widow.
<script language=javascript>
document.writeln(parent.location);
</script>
in the popup.

ahve you tried window.parent.parent?

Go with the flow & have fun! Else fight the flow



Still nothing...is this cause im trying to refresh in the code behind???

Is there any way to refresh the main page from the popup (that is open from a user control) via the code behind of that popup ?




Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-01-21 : 13:29:10
I've exhausted myself...with no results here...

Someone did earlier ask if the main page was doing a post back...and it is but I cant use an HTML button because it wont call the code behind page.

The problem I am having is a form opens up "reports" page as a popup frame with the top having a button to print / close the page. The bottom has a container for reporting service that opens a report.

The reports page opens than goes under the main browser window. Users dont have any idea that it is open unless they call me and I tell them to look at the bottom of their start menu and the notice its just hidden behind the main browser. I need this framed popup to be on top of the main app.

If anyone has more suggestions please let me know.

Jon



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page
   

- Advertisement -