Problem closing Browser with Window.Close

Reply

Join Date: Mar 2006
Posts: 18
Reputation: mikefitz is an unknown quantity at this point 
Solved Threads: 0
mikefitz mikefitz is offline Offline
Newbie Poster

Problem closing Browser with Window.Close

 
0
  #1
Dec 21st, 2006
Hi,
I have an ASP.NET application that will not close a Browser using the Javascript Window.Close() command.

I am opening a Browser on top of the current Browser to display and collect additional information. In the Click event of the command button on the pop-up Browser, I execute some VB.NET code prior to calling the javascript Window.Close() command. This works fine for three workstations in the office, but two workstations will execute the VB.NET code, but will not close the Browser, even clicking the X in the browser window will not close the pop-up Browser on these two workstations. They just hang. The Internet Options appear to be identical on all the workstations in the office. All the workstations are using Internet Explorer 6.0. Does anyone have any ideas as to why the pop-up Browser will not close on these two workstations?

Thanks,
Mike
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 1
Reputation: shatnawi is an unknown quantity at this point 
Solved Threads: 0
shatnawi shatnawi is offline Offline
Newbie Poster

Re: Problem closing Browser with Window.Close

 
0
  #2
Dec 21st, 2006
Hi man i will post this to help you in the situation

Here's the code for the parent page:
  1. [COLOR=blue]public[/COLOR] [COLOR=blue]class[/COLOR] Default : Page
  2. {
  3. [COLOR=blue]protected[/COLOR] TextBox txtFirstName;
  4. [COLOR=blue]protected[/COLOR] TextBox txtLastName;
  5. [COLOR=blue]protected[/COLOR] Label Label1;
  6. [COLOR=blue]protected[/COLOR] Label Label2;
  7. [COLOR=blue]protected[/COLOR] HyperLink HyperLink1;
  8.  
  9. [COLOR=blue]private[/COLOR] [COLOR=blue]void[/COLOR] Page_Load([COLOR=blue]object[/COLOR] sender, EventArgs e)
  10. {
  11. [COLOR=green]//create our update function[/COLOR]
  12. [COLOR=blue]string[/COLOR] scr = @"<script>
  13. function update(elemValue)
  14. {
  15. document.getElementById('txtFirstName').innerText=elemValue[0];
  16. document.getElementById('txtLastName').innerText=elemValue[1];
  17. }
  18. </script>";
  19. [COLOR=green]// register the javascript into the Page[/COLOR]
  20. Page.RegisterClientScriptBlock("update", scr);
  21. [COLOR=green]//add our popup onclick attribute to the desired element on the page (Here, Hyperlink1)[/COLOR]
  22. HyperLink1.Attributes.Add("onclick", "window.open('popup.aspx',null,'left=400, top=100, height=250, width= 250, status=n o, resizable= no, scrollbars= no, toolbar= no,location= no, menubar= no');");
  23.  
  24.  
  25. }

And, here's the code for the child "Popup" page:

  1. [COLOR=blue]public[/COLOR] [COLOR=blue]class[/COLOR] popup : System.Web.UI.Page
  2. {
  3. [COLOR=blue]protected[/COLOR] System.Web.UI.WebControls.TextBox TextBox1;
  4. [COLOR=blue]protected[/COLOR] System.Web.UI.WebControls.Label Label2;
  5. [COLOR=blue]protected[/COLOR] System.Web.UI.WebControls.TextBox txtLastName;
  6. [COLOR=blue]protected[/COLOR] System.Web.UI.WebControls.TextBox txtFirstName;
  7. [COLOR=blue]protected[/COLOR] System.Web.UI.WebControls.Label Label1;
  8.  
  9. [COLOR=blue]private[/COLOR] [COLOR=blue]void[/COLOR] Page_Load([COLOR=blue]object[/COLOR] sender, System.EventArgs e)
  10. {
  11. [COLOR=blue]string[/COLOR] scr= @"<script>
  12. function Done()
  13. {
  14. var fName=document.getElementById('txtFirstName').value;
  15. var lName=document.getElementById('txtLastName').value;
  16. var ret= new Array(fName,lName);
  17. window.opener.update(ret);
  18. window.close();
  19. }
  20. </script>;";
  21. Page.RegisterClientScriptBlock("done", scr);
  22. }
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 8810 | Replies: 1
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC