944,042 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 11189
  • ASP.NET RSS
Dec 21st, 2006
0

Problem closing Browser with Window.Close

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mikefitz is offline Offline
20 posts
since Mar 2006
Dec 21st, 2006
0

Re: Problem closing Browser with Window.Close

Hi man i will post this to help you in the situation

Here's the code for the parent page:
asp.net Syntax (Toggle Plain Text)
  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:

asp.net Syntax (Toggle Plain Text)
  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. }
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shatnawi is offline Offline
1 posts
since Dec 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Getting values from GridView Controls
Next Thread in ASP.NET Forum Timeline: Unwanted data injected into datagrid textbox





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC