By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,023 Members | 1,235 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,023 IT Pros & Developers. It's quick & easy.

window.open & RegisterClientScriptBlock

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.