Link to home
Start Free TrialLog in
Avatar of yourcous
yourcousFlag for United States of America

asked on

Object Expected Error in Dynamic aspx

I work with ASP.NET in VS2008 and I am a novice with Java Script.
Why am I getting this error and why do I get < instead of </script>
in my dynamic aspx?
asp.net code:
Response.Write("<script language='JavaScript' type = 'text/javascript'>ShowFile('" + filename + "','" + filePath + "');</script>")
 
Dynamic aspx:
<script language='JavaScript' type = 'text/javascript'>ShowFile('rptTicketDetailsPage3.htm','http://localhost:61780/Reports/rptTicketDetailsPage3.htm');<

Open in new window

Avatar of Bob Learned
Bob Learned
Flag of United States of America image

What is this code supposed to do?  What is it attached to?

Bob
Avatar of yourcous

ASKER

Dim filePath As String
Dim filename As String = "rptTicketDetailsPage3.htm"

filePath = "http://" + Request.Url.Host + ":61780" + Request.ApplicationPath + "Reports/" + filename
Response.Write("<script language='JavaScript' type = 'text/javascript'>ShowFile('" + filename + "','" + filePath + "');</script>")

That's the code.
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Your Highness, TheLearnedOne,

What is HTMLText? Is it an htm control or an object?

Thank you.
Sorry, got going a little too fast *WINK*.

        <div runat="server" id="HTMLText" />


Bob
TheLearnedOne,

Your code worked.
My mistake was that I did not say that
what I really wanted to do is to show a .PDF file.
So I can't use this code.

humbly,
yourcous
Where is the PDF file coming from?

Bob
I converted an MS Access database into SQL Server.
When a user asks for a report, my AS.net code passes query parameters into the old MS Acces report.
Access exports the report
into PDF format. My ASP.net app opens the PDF file.
I did not want to redesign 100+ reports, so I convert them to pdf.

I would also prefer to delete the page once the user is done with the report, but that's a minor issue.
>>My ASP.net app opens the PDF file
You can use Response.WriteFile to display a PDF document to the browser:

    Response.ContentType = "application/pdf"
    Response.WriteFile(Server.MapPath("PDF/Document.pdf"))

Bob
Awsome!
Bob,
Your truly the best!

Thank you.
Bob,

I use your code:
Response.ContentType = "application/pdf"
        Response.WriteFile(Server.MapPath("~/reports/rptTicketDetails18.pdf"))


I get two pages open, one - a pdf file open with pdf, the other - a copy of the
file in IE. I only want the pdf one. How can I fix it?

Thanks,

yourcous