This seems to work OK, let me know if you think this is a viable solution. The Main page now has an Event listener to catch the hide and then close the window there. I have altered the sample so the Child page hides the window instead of closing it. The Main page then reloads to reflect changes made in the window. In the actual application the window is for data entry and the button click goes back to the server to do validation and save to database, then close the window and it's destroyed because each time it's opened it's completely different. X.Js.AddScript("parentAutoLoadControl.close() ") This method is used to close the window which is opened by the window.open() method. To make this, we will use window.close() method. Protected void btnClose_Click(object sender, DirectEventArgs e) In this article, we will see how to close the current tab in a browser window using JavaScript. Protected void btnOpen_Click(object sender, DirectEventArgs e)Ĭhild page loaded into Window, hit Close button Main Page to run, hit button to open window: Syntax: window.close () Parameters: This method does not accept any parameters. Net 4.0, please let me know what you think. JavaScript window.close () method, is used for closing a certain window or tab of the browser which was previously opened by the window.open () method. Below is sample code, I'm using v2.5.1 in VS2010. I also found it works in Chrome v35 and FireFox v28. If I run IE10 in compatability mode it runs fine. The script contains a function in which we have defined a variable mywindow and opened the new window, then we closed the current window using the close(). I have a Main page that opens a Window, it has a Close button that calls a DirectEvent to go back to server to do 'stuff' then does the script include of parentAutoLoadControl.close() In IE10 I now get a javascript error "'Array' is undefined" on a fireEventArgs() call. My company is (finally) upgrading from IE8, and in testing with IE10 i've come across an error closing a window that works in IE8, and IE10 in compatability mode.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |