473,320 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Closing a window from code behind

Looks like this is either too obvious for anyone to address, or it just
isn't done by anyone. There was a question in early sep this year that no
one replied to, and I don't find any other references. So here goes again:

I want to close my popup from an asp codebehind event handler. The
following does not work (this is an event handler for the Login control)

protected void OnLoggedIn(object sender, EventArgs e)
{
Response.Write ("<script language =
javascript>close();</script>");
}

Instead of closing the window and returning to the calling window, the
calling page is opened (again) in the same window.

Jeremy

Nov 22 '07 #1
4 13919
try putting Response.End after it

did u try debug break in onloggedin? does it go there?

On Nov 22, 8:11 am, "Jeremy" <jeremy-nos...@ninprodata.comwrote:
Looks like this is either too obvious for anyone to address, or it just
isn't done by anyone. There was a question in early sep this year that no
one replied to, and I don't find any other references. So here goes again:

I want to close my popup from an asp codebehind event handler. The
following does not work (this is an event handler for the Login control)

protected void OnLoggedIn(object sender, EventArgs e)
{
Response.Write ("<script language =
javascript>close();</script>");
}

Instead of closing the window and returning to the calling window, the
calling page is opened (again) in the same window.

Jeremy
Nov 22 '07 #2
Nick, bless you! Response.end() is the answer.

Mark Rae, in a different thread is saying that this technique of pumping
script into html is a bad thing. Unfortunately, I don't know any other way
to get the window closed from codebehind. Is there some other technique? He
suggests registering a client script, but that begs the question; how to
call the script from codebehind?

Jeremy

"Nick Chan" <zz*******@yahoo.comwrote in message
news:ee**********************************@e10g2000 prf.googlegroups.com...
try putting Response.End after it

did u try debug break in onloggedin? does it go there?

On Nov 22, 8:11 am, "Jeremy" <jeremy-nos...@ninprodata.comwrote:
>Looks like this is either too obvious for anyone to address, or it just
isn't done by anyone. There was a question in early sep this year that
no
one replied to, and I don't find any other references. So here goes
again:

I want to close my popup from an asp codebehind event handler. The
following does not work (this is an event handler for the Login control)

protected void OnLoggedIn(object sender, EventArgs e)
{
Response.Write ("<script language =
javascript>close();</script>");
}

Instead of closing the window and returning to the calling window, the
calling page is opened (again) in the same window.

Jeremy
Nov 22 '07 #3
This is the only way, always remember that manipulating windows occur in the
client side, hence the client side script is use to meet this requirements.
"Jeremy" wrote:
Nick, bless you! Response.end() is the answer.

Mark Rae, in a different thread is saying that this technique of pumping
script into html is a bad thing. Unfortunately, I don't know any other way
to get the window closed from codebehind. Is there some other technique? He
suggests registering a client script, but that begs the question; how to
call the script from codebehind?

Jeremy

"Nick Chan" <zz*******@yahoo.comwrote in message
news:ee**********************************@e10g2000 prf.googlegroups.com...
try putting Response.End after it

did u try debug break in onloggedin? does it go there?

On Nov 22, 8:11 am, "Jeremy" <jeremy-nos...@ninprodata.comwrote:
Looks like this is either too obvious for anyone to address, or it just
isn't done by anyone. There was a question in early sep this year that
no
one replied to, and I don't find any other references. So here goes
again:

I want to close my popup from an asp codebehind event handler. The
following does not work (this is an event handler for the Login control)

protected void OnLoggedIn(object sender, EventArgs e)
{
Response.Write ("<script language =
javascript>close();</script>");
}

Instead of closing the window and returning to the calling window, the
calling page is opened (again) in the same window.

Jeremy

Nov 22 '07 #4
it is very odd that in your case response.write without response.end
wont work
maybe it has something to do with login control
if response.write without response.end wont work, i doubt registering
client script will

anyway, to register client script :

Page.ClientScript.RegisterStartupScript(Page.GetTy pe,
"scriptName_FreeText", "<script type=""text/javascript"">close()</
script>")

(or RegisterClientScript, i think!)

On Nov 22, 9:56 am, "Jeremy" <jeremy-nos...@ninprodata.comwrote:
Nick, bless you! Response.end() is the answer.

Mark Rae, in a different thread is saying that this technique of pumping
script into html is a bad thing. Unfortunately, I don't know any other way
to get the window closed from codebehind. Is there some other technique? He
suggests registering a client script, but that begs the question; how to
call the script from codebehind?

Jeremy

"Nick Chan" <zzzxtr...@yahoo.comwrote in message

news:ee**********************************@e10g2000 prf.googlegroups.com...
try putting Response.End after it
did u try debug break in onloggedin? does it go there?
On Nov 22, 8:11 am, "Jeremy" <jeremy-nos...@ninprodata.comwrote:
Looks like this is either too obvious for anyone to address, or it just
isn't done by anyone. There was a question in early sep this year that
no
one replied to, and I don't find any other references. So here goes
again:
I want to close my popup from an asp codebehind event handler. The
following does not work (this is an event handler for the Login control)
protected void OnLoggedIn(object sender, EventArgs e)
{
Response.Write ("<script language =
javascript>close();</script>");
}
Instead of closing the window and returning to the calling window, the
calling page is opened (again) in the same window.
Jeremy- Hide quoted text -

- Show quoted text -
Nov 22 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ron L | last post by:
I have an MDI application with a number of child windows. In each child window I am catching the Closing event and having the child window decide if it should set cancel to true. The intent here...
4
by: SteveS | last post by:
Hello. This is a strange problem which does not make sense to me. I open a popup page with the following javascript code: function OpenDenyWindow(changeId) {...
3
by: Chrysan | last post by:
I have a popup window, which consist of a asp:textbox and a asp:button. And, I would like to pass the textbox.text to the javascript function when I click the button. Besides, by clicking the...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
2
by: Tom | last post by:
How is the best way to avoid validation when closing a window? For instance, I have a Windows Forms window which has a validation event for a text box. However, if one enters invalid data in then...
1
by: srinivas | last post by:
Hi I'm having a asp.net page.When i'm clicking on the Logout hyperlink i want to close the window and clear the session. Actually i have taken LinkButton control and written a javascript function...
10
by: Tony | last post by:
I need to know how to open a pop up and close the main window without a prompt in Firefox 2 and IE 7. Anybody have any ideas on how to do that. I currently have this and it works in IE 6 and...
11
by: Simon van Beek | last post by:
Dear reader, By opening an application I get always the main Access window with the closing cross in the above right corner. Is there a possibility to make this closing cross invisible? ...
6
by: Todd Cary | last post by:
I create a new window with onClick="openBrWindow(\'claimant_pdf.php\',\'\',\'toolbar=no,status=yes,scrollbars=no,resizable=no\')" as part of a submit button. Now I would like to close the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.