| | |
Problem closing Browser with Window.Close
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2006
Posts: 18
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Dec 2006
Posts: 1
Reputation:
Solved Threads: 0
Hi man i will post this to help you in the situation
Here's the code for the parent page:
And, here's the code for the child "Popup" page:
Here's the code for the parent page:
asp.net Syntax (Toggle Plain Text)
[COLOR=blue]public[/COLOR] [COLOR=blue]class[/COLOR] Default : Page { [COLOR=blue]protected[/COLOR] TextBox txtFirstName; [COLOR=blue]protected[/COLOR] TextBox txtLastName; [COLOR=blue]protected[/COLOR] Label Label1; [COLOR=blue]protected[/COLOR] Label Label2; [COLOR=blue]protected[/COLOR] HyperLink HyperLink1; [COLOR=blue]private[/COLOR] [COLOR=blue]void[/COLOR] Page_Load([COLOR=blue]object[/COLOR] sender, EventArgs e) { [COLOR=green]//create our update function[/COLOR] [COLOR=blue]string[/COLOR] scr = @"<script> function update(elemValue) { document.getElementById('txtFirstName').innerText=elemValue[0]; document.getElementById('txtLastName').innerText=elemValue[1]; } </script>"; [COLOR=green]// register the javascript into the Page[/COLOR] Page.RegisterClientScriptBlock("update", scr); [COLOR=green]//add our popup onclick attribute to the desired element on the page (Here, Hyperlink1)[/COLOR] 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');"); }
And, here's the code for the child "Popup" page:
asp.net Syntax (Toggle Plain Text)
[COLOR=blue]public[/COLOR] [COLOR=blue]class[/COLOR] popup : System.Web.UI.Page { [COLOR=blue]protected[/COLOR] System.Web.UI.WebControls.TextBox TextBox1; [COLOR=blue]protected[/COLOR] System.Web.UI.WebControls.Label Label2; [COLOR=blue]protected[/COLOR] System.Web.UI.WebControls.TextBox txtLastName; [COLOR=blue]protected[/COLOR] System.Web.UI.WebControls.TextBox txtFirstName; [COLOR=blue]protected[/COLOR] System.Web.UI.WebControls.Label Label1; [COLOR=blue]private[/COLOR] [COLOR=blue]void[/COLOR] Page_Load([COLOR=blue]object[/COLOR] sender, System.EventArgs e) { [COLOR=blue]string[/COLOR] scr= @"<script> function Done() { var fName=document.getElementById('txtFirstName').value; var lName=document.getElementById('txtLastName').value; var ret= new Array(fName,lName); window.opener.update(ret); window.close(); } </script>;"; Page.RegisterClientScriptBlock("done", scr); }
![]() |
Similar Threads
- problem IE (runonce) has taken over my browser (DaniWeb Community Feedback)
- Internet Explorer multiple windows problem - XP (Web Browsers)
- new window popup (HTML and CSS)
- window.close() not working in flash MX??? (Graphics and Multimedia)
- Formac Studio Remote (Mac Software)
- IE 6.0 browser window closes on submit (Web Browsers)
- closing a window (Java)
Other Threads in the ASP.NET Forum
- Previous Thread: Getting values from GridView Controls
- Next Thread: Unwanted data injected into datagrid textbox
Views: 8810 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 ajax alltypeofvideos appliances application asp asp.net beginner box browser button c# cac checkbox class complex connection control countryselector dataaccesslayer database datagridview datalist deployment development dgv dialog dropdownlist dynamic dynamically edit editing embeddingactivexcontrol feedback fileuploader fill findcontrol flash form gridview gudi iis image javascript languages list listbox login maps microsoft mobile mouse mssql news novell numerical opera panelmasterpagebuttoncontrols parent problem profile project radio redirect registration relationaldatabases reportemail response.redirect richtextbox rows schoolproject search security select services sessionvariables silverlight smoobjects software sql sql-server ssl theft tracking treeview validatedate validation vb.net videos vista visualstudio vs2008 web webapplications webdevelopment webprogramming webservice wizard xsl





