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

window.open & RegisterClientScriptBlock

Hello,

I try to open a new Window in code behind with :
ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "MyOpenScript",
"window.open('toto.doc');", true);

My problem is that the new window is created but it disappears immediatly
just after creation!!

For information, I tried this:

ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "MyOpenScript",
"window.location=''toto.doc';", true);

IE7 ask me to validate the download in the top of the browser (it is a
security message that we have to validate to continue...)

I tried also this:

ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "MyOpenScript",
"window.open(Image.jpg');", true);

I have a new Window with my image!

In fact, it doesn't work with files that need to have the validation message
(open, save to disk, cancel)

How can I download these kind of files ?

Thanks,

David.
Jul 10 '07 #1
3 6615
On Jul 11, 5:13 am, <Davidwrote:
Hello,

I try to open a new Window in code behind with :
ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "MyOpenScript",
"window.open('toto.doc');", true);

My problem is that the new window is created but it disappears immediatly
just after creation!!

For information, I tried this:

ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "MyOpenScript",
"window.location=''toto.doc';", true);

IE7 ask me to validate the download in the top of the browser (it is a
security message that we have to validate to continue...)

I tried also this:

ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "MyOpenScript",
"window.open(Image.jpg');", true);

I have a new Window with my image!

In fact, it doesn't work with files that need to have the validation message
(open, save to disk, cancel)

How can I download these kind of files ?

Thanks,

David.
hi,
try this from code behind hope help

//Set the appropriate ContentType.
Response.ContentType = "Application/doc";
//Get the physical path to the file.
string FilePath = MapPath("s.doc");
//Write the file directly to the HTTP content output stream.
Response.WriteFile(FilePath);
Response.End();

nahid
http://nahidulkibria.blogspot.com/
http://www.kaz.com.bd

Jul 10 '07 #2
Hi,

Sorry but I have an error message on my page :
The XML page can't be displayed ...

A bad caracter has been found in a text content...

More, I want to open a new window with the content file inside, not the the
page itself.

In fact, this code could work :
ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "MyOpenScript",
"window.open('toto.doc');", true);

Maybe a parameter in IE7 to change ?
Why my new page begins to be displayed and disappears immediatly ?
Why does it work with a text file or an image file ?

Thanks in advance,
David.
"nahid" <na******@gmail.coma écrit dans le message de news:
11**********************@n2g2000hse.googlegroups.c om...
On Jul 11, 5:13 am, <Davidwrote:
>Hello,

I try to open a new Window in code behind with :
ClientScript.RegisterClientScriptBlock(this.GetTy pe(), "MyOpenScript",
"window.open('toto.doc');", true);

My problem is that the new window is created but it disappears immediatly
just after creation!!

For information, I tried this:

ClientScript.RegisterClientScriptBlock(this.GetTy pe(), "MyOpenScript",
"window.location=''toto.doc';", true);

IE7 ask me to validate the download in the top of the browser (it is a
security message that we have to validate to continue...)

I tried also this:

ClientScript.RegisterClientScriptBlock(this.GetTy pe(), "MyOpenScript",
"window.open(Image.jpg');", true);

I have a new Window with my image!

In fact, it doesn't work with files that need to have the validation
message
(open, save to disk, cancel)

How can I download these kind of files ?

Thanks,

David.

hi,
try this from code behind hope help

//Set the appropriate ContentType.
Response.ContentType = "Application/doc";
//Get the physical path to the file.
string FilePath = MapPath("s.doc");
//Write the file directly to the HTTP content output stream.
Response.WriteFile(FilePath);
Response.End();

nahid
http://nahidulkibria.blogspot.com/
http://www.kaz.com.bd

Jul 11 '07 #3
In fact, I have to encode as "application/msword"

It works but I still want to create a new window...

If I use the code Response.WriteFile in a second webpage and I call it from
my startpage with RegisterClientScriptBlock and window.open, the problem is
still here!
I hear the sound like IE blocks a new popup window even if I authorize IE...

What can I do else?
Thanks.

<Davida écrit dans le message de news:
eo****************@TK2MSFTNGP03.phx.gbl...
Hi,

Sorry but I have an error message on my page :
The XML page can't be displayed ...

A bad caracter has been found in a text content...

More, I want to open a new window with the content file inside, not the
the page itself.

In fact, this code could work :
ClientScript.RegisterClientScriptBlock(this.GetTyp e(), "MyOpenScript",
"window.open('toto.doc');", true);

Maybe a parameter in IE7 to change ?
Why my new page begins to be displayed and disappears immediatly ?
Why does it work with a text file or an image file ?

Thanks in advance,
David.
"nahid" <na******@gmail.coma écrit dans le message de news:
11**********************@n2g2000hse.googlegroups.c om...
>On Jul 11, 5:13 am, <Davidwrote:
>>Hello,

I try to open a new Window in code behind with :
ClientScript.RegisterClientScriptBlock(this.GetT ype(), "MyOpenScript",
"window.open('toto.doc');", true);

My problem is that the new window is created but it disappears
immediatly
just after creation!!

For information, I tried this:

ClientScript.RegisterClientScriptBlock(this.GetT ype(), "MyOpenScript",
"window.location=''toto.doc';", true);

IE7 ask me to validate the download in the top of the browser (it is a
security message that we have to validate to continue...)

I tried also this:

ClientScript.RegisterClientScriptBlock(this.GetT ype(), "MyOpenScript",
"window.open(Image.jpg');", true);

I have a new Window with my image!

In fact, it doesn't work with files that need to have the validation
message
(open, save to disk, cancel)

How can I download these kind of files ?

Thanks,

David.

hi,
try this from code behind hope help

//Set the appropriate ContentType.
Response.ContentType = "Application/doc";
//Get the physical path to the file.
string FilePath = MapPath("s.doc");
//Write the file directly to the HTTP content output stream.
Response.WriteFile(FilePath);
Response.End();

nahid
http://nahidulkibria.blogspot.com/
http://www.kaz.com.bd


Jul 11 '07 #4

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

Similar topics

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...
8
by: VB Programmer | last post by:
On some websites I've seen by clicking on a button or hlink a new IE browser window is spawned that does NOT have any toolbar (ie No back button, etc...) How can I do this on my ASPX page? ...
4
by: DM | last post by:
Is there any way, using a server control, to execute a routine (say, add record to database) and then close the browser window. I'm having a difficult time doing this using a master\detail model...
8
by: David W. Simmonds | last post by:
Is there an easy way to create a new browser window from C# and ASP.NET? I would just like to have a popup window without any menus or toolbars that would contain a high-res image. The low-res...
0
by: IndyChris | last post by:
I've got a button my webpage that when clicked will open another window. Different criteria on the page will deteremine which window gets opened when the button is clicked. I have a switch...
9
by: Stan B | last post by:
I create a popup window by calling window.showModalDialog Popup window has Ok button with this code attached: === string Script = "<script language=JavaScript>" + "{" + "window.close();" +...
9
by: smokeyd | last post by:
hi, can anyone tell me how to open a link in a new browser window in vbscript.net. i am looking to be able to set the properties such as size, menu bar, scroll bar etc. or alternativelly is...
6
by: SAL | last post by:
Hi, VS2005 post I'm opening a window using the following syntax: Protected Sub lbEstValue_Click(ByVal sender As Object, ByVal e As System.EventArgs)...
1
by: Ramachand | last post by:
Actually I have to call a dialog window "Dwin1" from a Parent Window. From Dwin1, I have to call another Dialog Window "Dwin2".if user close the Dialog Window "Dwin2", i have to refersh the Dwin1....
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.