Javascript error ... I think
I have been trying to fix this for two hours in a row and I cannot figure it out.
onclick = "location='exceltest.asp?vanjaar=<%=vanjaar%>&vanmaand=<%=vanmaand%>&vandag=<%=vandag%>&totjaar=<%=totjaar%>&totmaand=<%=totmaand%>&totdag=<%=totdag%>'"
This line of code is found in <input type = "button" / ">. The button is bound to the page on which the Excel load should start. The values ββin the URL are from-to-date. (Year, month, day)
onclick = "location='exceltest.asp?fromdate=<%=fromdate%>&todate=<%=todate%>'" />
doesn't work because somehow IE7 reads the date incorrectly (e.g. 2008/1/1). I think it has something to do with the forward slash.
But when I try to click a button in IE and thus download the generated file, Internet Explorer tries to download the file
exceltest.asp? Vanjaar = 2008vanmaand = 1vandag = 1totjaar = 2008totmaand = 2totdag = 1
instead of the excel file I want.
FF suggests to download excelfile, but gives (in this excelfile) an overview of the htmlpage with an error saying my request is incorrect (the item cannot be found in the collection matching the requested name or order.) But it CAN'T be, I am using the same request elsewhere using the same (but restarted) connection.
This is the bit of code I'm using to instantiate the file upload:
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "content-disposition", "attachment; filename=overicht.xls"
Actually, maybe something is going on, but what I'm most interested in is why IE wants to load the asp page while FF suggests loading correctly.
source to share
Something that might help: Server.URLEncode
fromdate=<%=Server.URLEncode(fromdate)%>
But your Excel file error is - Item could not be found in the collection matching the requested name or order. - from . You are trying to grab a field that is not available - either a column name that is not in your query, or an index that is outside of your column. Recordset.Fields()
source to share