469,627 Members | 932 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,627 developers. It's quick & easy.

Export Excel Question

Hi all,

I have a parent page(parent.aspx) which will open different new windows
depending on the user input.

for example,
the new windows are opened using the following code :
window.open('child.aspx', document.userinput.value)

In the child.aspx, the result is rendered as Excel, Word, PDF, etc...
depending on the input parameters from the parent pages.

There is no problem when the user just open 1 pop up window.
However, when the user first open a Excel Window, and then open another
window (Word) , the first window will become blank. Then the result in the
second window
will become the result in first window (Excel).

Thank You.
Sep 20 '06 #1
1 1477
Here are the sample codes.
Parent.html :

<script language=javascript>
function OpenWindow()
var oWnd = window.open('', document.frmOption.selOption.value);
document.frmOption.target = document.frmOption.selOption.value;

<form id=frmOption name=frmOption method=post action="child.aspx">
<select id=selOption name=selOption>
<option value=1>Excel</option>
<option value=2>Word</option>
<input type=button value="Open Window" onclick="OpenWindow()">

Put the following code in Child.aspx :

if (Request["selOption"].ToString().Trim() == "1")
Response.ContentType = "application/vnd.ms-excel";
Response.Write("This is Excel");
Response.ContentType = "application/vnd.msword";
Response.Write("This is Word");

if Request("selOption").ToString().Trim() = "1" Then
Response.ContentType = "application/vnd.ms-excel"
Response.Write("This is Excel")
Response.ContentType = "application/vnd.msword"
Response.Write("This is Word")
end if

Sep 20 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Matt | last post: by
5 posts views Thread by Igor | last post: by
13 posts views Thread by Hemant Sipahimalani | last post: by
5 posts views Thread by karthick | last post: by
3 posts views Thread by =?Utf-8?B?YzY3NjIyOA==?= | last post: by
19 posts views Thread by cj2 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.