473,434 Members | 1,657 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,434 software developers and data experts.

Can't close popup window from codebehind...

Hi Friends,

I simply want to print a report by opening a popup, calling the print
function and closing the window after the user has printed the
report.

I have 2 functions.... in c#

The Onload event registers a script to close the window from c#. The
FillReport functions fills a gridview

I have a JavaScript Function AssignContent(); which simply calls
window.print() and window.close()

This code runs fine in Firefox but the window is not closing in
Internet Explorer 6

I am also giving the code ... plz suggest me some solution.. i simply
cannot close the window in ie6.

Here is the code....

C# Code
---------------------------------------------------
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

fillreport();
if (!ClientScript.IsClientScriptBlockRegistered("k1") )
{
ClientScript.RegisterClientScriptBlock(this.GetTyp e(),
"k1", "<script language='javascript'>AssignContent();</
script>");
}
}
}

private void fillreport()
{
//fills a gridview
}

//JavaScript
-------------------------------------
function AssignContent()
{
window.print();
window.close();
}


Regards,
Mahernoz

Sep 6 '07 #1
0 2658

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

Similar topics

1
by: Guy | last post by:
I have 4 images on a page and when someone clicks on one of them I open a secondary window and write a few lines to it describing the image. If they don't close that secondary window however, and...
11
by: JSjones | last post by:
when a form is submitted from the main window i want a pop up window to open from the onclick event. i have that working, now how can i close the pop up window from the main window after the main...
2
by: Mark | last post by:
The situtation is that I'm trying to ensure that certain functions are only called by functions that I want them to be called from. I have a popup window which has a function which calls a function...
7
by: Jens Peter Hansen | last post by:
Hi From my main window I open a series of popup (one close - next opens) in a mockup for a registration proces. From the last popup, I want to click a buttom, so the popup closes and the URL in...
4
by: GrantS | last post by:
I am having a problem closing a popup window opened modally. When I try to close the window (when the user hits save button and the data has been processed), the Popup window opens as a full screen...
0
by: aiasso | last post by:
Hi All, Need big time help with this one. I'm using Forms Authentication with an ASP.NET (VB.NET) web app, and everything is fine until the client opens a popup window using javascript on the...
15
by: Mahernoz | last post by:
Hi Friends, I simply want to print a report by opening a popup, calling the print function and closing the window after the user has printed the report. I have 2 functions.... in c# The...
1
by: dittu | last post by:
How to close the popup window when submitting the form? I have a sample.jsp. In that page one button is there. when button pressed, open popup window contains one "text box" and one " submit...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.