|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Closing window/pageUse code-behind form, visual basic, running some code behind a command
button, all good...the last step though should be that the use is prompted with a message, and then the window or page should close...can't figure out how to do this otherwise simple task. I imagine DHTML could do it, but I should be able to access the browser window's methods from VB.Net also, right? I tried the obvious...Page.Close...well there is no Close method, and Dispose isn't right... Could someone point me in the right drection? Thanks! Steve Ok...figured that part out...must you client side code in order to use
the Close method of the Window object. Well, that leaves me in a bind...the button still first needs to run code, VB.Net code...and close the window...can I do both? use page.registerstartupscript
and run window.close from there note that many browsers will show an alert if you use this to close a window that has been explicitly opened by the user Most excellent...now if I could just figure out what the 'key' value
really represents so that it actually runs it... addup wrote: Show quoteHide quote > use page.registerstartupscript > and run window.close from there > > note that many browsers will show an alert if you use this to close a > window that has been explicitly opened by the user Unfortuantely the example provided my MS here:
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemWebUIPageClassRegisterStartupScriptTopic.htm 1. Shows the example not using code-behind VB, but client side only 2. The Key value appears by thier example so arbitrary value assiged by the coder by random. Would make sense if the id value of the script block matched the key value argument of RegisterStartupScript but that doesn't appear to be the case (I tried). <sigh> LOL
I just use a generic function in my (common) base class Public Sub RunScript(ByVal Page As System.Web.UI.Page, ByVal Script As String) Static iSeq As Integer = 0 Page.RegisterStartupScript("Script" & iSeq, "<SCRIPT language='javascript'>" & Script & "</SCRIPT>") iSeq += 1End Sub that I can invoke simply by RunScript("window.close();") That works perfect!
Well after I added the Page argument to RunScript...call :) Thank you very much addup!
What functionality does Infragistics controls offer, which don't come with VS .NET 2005?
Master Pages and Cross-Page Form Information grid postback Listbox is overlapping the Textbox in Asp.net Datagrid Basic formatting for HTML text in ASP.NET 1.1 ? Adding a Directive to a dynamically created Template Column on gri Hi Is there a way to set onmouseover for a LinkButton in ASP.NET 2.0 ? timer functionality |
|||||||||||||||||||||||