Webform issue with ASP.NET 2.0.

F

ffhansix

Hi,

I have migrated a web site from .NET 1.1.4322 to .NET 2.0. After the
migration my Modal webform does not work as it did in 1.1.

The webform pops up from a page when a user clicks a button:
The following line is run in the codebehind file:

Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
"imgExportToExcel_Click", "<script
language='JavaScript'>window.showModalDialog('ExportToExcel.aspx?ClientID="
+ ddlClients.SelectedValue + "&FromPeriod=1&ToPeriod=" +
ddlToPeriod.SelectedValue + "&BudgetYear=" + intSelBudgetYear + "',
null,'status:no;dialogWidth:240px;dialogHeight:150px;dialogHide:true;help:no;scroll:no');</script>");

Both pages that run (both the startpage and the modal webform page) has
the @page directive enableEventValidation="false".

On the modal webform page there are two buttons (servercontrols) cancel
and ok, if the user presses ok, some lines are executed to create an
Excel spreadsheet with the help of a third-party serverside component
(Aspose.Excel).

Extract.....
Response.ContentType = "application/vnd.ms-excel";
objExcel.Save(Settings.ExcelSettings_FileName, SaveType.OpenInExcel,
(Aspose.Excel.FileFormatType) intExcelVersion, this.Response);
......

The code does exactly what it should do (give the user a question,
open/save dialog for the generated Excel file) if i remove the <base
target=_self></base> from the aspx page, but then at every post i make
a new window is opened.

Could someone please help me with this issue, i have tried changing
many things but i just cannot get it to work as it did in .NET 1.1.

Sincerely
/Hans Sixhöj
 
F

ffhansix

Hi,

I have sloved the problem. Instead of implementing the <base
target=_self></base> tag to get the modal webform to post to itself and
not a new window I have now changed into using an <iframe:

<iframe
src="ExportToExcel.aspx?ClientID=<%=Request.QueryString["ClientID"]%>&FromPeriod=1&ToPeriod=<%=Request.QueryString["ToPeriod"]%>&BudgetYear=<%=Request.QueryString["BudgetYear"]%>"
name="embeddedFrame" width="100%" height="100%" scrolling=no />

This works perfectly and the serverside code executes and displays the
open/save dialog when i push the Excel document to the client.

The strange thing is why my original solution worked in ASP.NET 1.1 but
not in ASP.NET 2.0 - to this I have not found an answer.

Sincerely,
Hans Sixhöj
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top