|
I haven't tested this or played with it...but just looking at the code you supplied it seems like this line:
fullpath = lblCurrentPath.Text & lstLogFiles.SelectedItem.Text
should be something more like this
fullpath = lblCurrentPath.Text & lstLogFiles.Items.Item(i).ToString
|
|
|
|
|
Interesting, did not know about ToString, but it does not seem to make a difference
any other ideas? It seems like after file is downloaded the procedure exits...
|
|
|
|
|
Hmmm. I don't do a lot with List objects, so I'm not sure what is going on. You said "It seems like after file is downloaded the procedure exits"...did you debug and actually see this happen?
If that is the case then perhaps the For statement is off somehow. What does the list.count show when you debug?
You could try doing a
For Each str as String In lst.SelectedItems If the List object has that option...Other than that, perhaps there is something within the DownloadFile method that is causing a problem. Can you supply us with that code?
-- modified at 14:45 Tuesday 20th February, 2007
|
|
|
|
|
Not sure the loop is getting messed up, I jsut verified that. I call the download function below, when the .Writefile is called the user is presented with a dialogue box to save the file, as soon as "OK" is clicked the file is saved and the debugger does not allow any stepping, step out of procedure or anything.
I just placed a break point on the "Page Load" event and found that it is called as soon as I click the button, but it does not appear that impacts the selections.
Private Sub DownloadFile(ByVal fname As String, ByVal forceDownload As Boolean)<br />
Dim path As Path<br />
Dim fullpath = path.GetFullPath(fname)<br />
Dim name = path.GetFileName(fullpath)<br />
Dim ext = path.GetExtension(fullpath)<br />
Dim type As String = ""<br />
<br />
If Not IsDBNull(ext) Then<br />
ext = LCase(ext)<br />
End If<br />
<br />
Select Case ext<br />
Case ".htm", ".html"<br />
type = "text/HTML"<br />
Case ".txt"<br />
type = "text/plain"<br />
Case ".doc", ".rtf"<br />
type = "Application/msword"<br />
Case ".csv", ".xls"<br />
type = "Application/x-msexcel"<br />
Case Else<br />
type = "text/plain"<br />
End Select<br />
<br />
If (forceDownload) Then<br />
Response.AppendHeader("content-disposition", _<br />
"attachment; filename=" + name)<br />
End If<br />
If type <> "" Then<br />
Response.ContentType = type<br />
End If<br />
<br />
Response.WriteFile(fullpath)<br />
Response.End()<br />
<br />
End Sub
|
|
|
|
|
Okay. I think your problem is the Response.End statement. That statement is going to finish all processing and push the page out with whatever information it currently has. I haven't done a file download exactly like this, so I'm not sure if just removing the statement will work or if you need to replace it with something else, but you can give it a shot and see what happens.
Hope this helps.
|
|
|
|
|
I am afraid removing the .End does not help, nor does moving the essence of the subroutine back into the original button click event. If you have any other ideas I am willing to listen.
|
|
|
|
|
As far as I'm aware you can't push multiple files to a browser - in other words what you're trying to do just isn't possible.
|
|
|
|
|
hi all
can any body tell me how to include file in vbs file
SP
--
Bugs can neither be created nor be removed from software by a developer. They can only be converted from one form to another. The total number of bugs in the software always remain constant.
|
|
|
|
|
How do you mean ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi i want to include JAVASCRIPT FILE in VBscript is it possible ? & how?
SP
--
Bugs can neither be created nor be removed from software by a developer. They can only be converted from one form to another. The total number of bugs in the software always remain constant.
|
|
|
|
|
You're using ASP ? When I did ASP, we used VB script for the server side code. AFAIK, only javascript can run on the client. I don't believe you can mix them, for that reason. Why do you want to ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Looks like you can combine them for IE6:
<html>
<body>
hello
<script language="javascript">
var1 = 'Wibble' ;
</script>
<script language="vbscript">
call msgbox(var1)
</script>
</body>
</html> Of course, that doesn't mean that you should.
Regards
Andy
|
|
|
|
|
If you need to include a VBScript file into your web page (to run in your browser then use:
<script src="Inc/global.vbs" language="VbScript"> </script> However, you should really be using JavaScript if you want users to use anything other than IE. If you need to include a VBScript file into your ASP page (to run on your web server) then use:
<!--#include file="Inc/GenScreen.asp" --> If you are using CScript.exe to run VBS on your desktop then use:
<?xml version="1.0" standalone="yes"?>
<?job error="false" debug="false"?>
<package>
<job id="main">
<reference guid="00000205-0000-0010-8000-00AA006D2EA4"/>
<reference object="Scripting.FileSystemObject" />
<script language="vbscript" src="Utils.vbs"/>
<script language="vbscript">
<![CDATA[
'Your script goes here.
]]>
</script>
</job>
</package> If you want to get reeeeeeally frisky then you can use VBScript to create WSC COM components!!! VBScript rocks
Hope that helps.
Andy
|
|
|
|
|
hi,
I'm having problem with seeing my datagrid? Yet I set Property visible to true and I'm caling the DataBind() what could be the Problem. I mayed be forgetting something.. Could you please help?
Thanks?
|
|
|
|
|
Check in the debugger - if your data source is empty, you won't see anything.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i think your datasource may be empty otherwise if you are using dataset, the dataset.tables(0) may be empty.
Check the datasource
Sathesh Pandian
|
|
|
|
|
Hi,
How would I be sure to know if data source is empty or not?
Thanks.
|
|
|
|
|
check
Tables[0].Rows.Count;
All I ever wanted is what others have....
CrazySanker
|
|
|
|
|
I have a table in asp and im using vb a code language. I have a table showing all the records. Please tell me how can i export them (in the same format like excel), may it be a pdf file, word or excel. Or can we print it directly using some built in feature.
Thanks
Bye
|
|
|
|
|
its simple friend..
u need to add
Response.ContentType = "application/vnd.ms-excel"
Response.Addheader "content-disposition", "inline; filename=YourFileName.xls"
these two lines top of ur page
ok
bye
Thanks,
Ankur Bakliwal
|
|
|
|
|
Where should i place this code. its not working.
Bye
|
|
|
|
|
these lines must be writen in
<%
line 1
line 2
%>
top of the 2nd page
u have to give a link of 2nd page for export, then in 2nd page u need to write that lines
ok
this will work
try it.
bye
Thanks,
Ankur Bakliwal
|
|
|
|
|
Use a different language.
Brad
Australian
- Christian Graus on "Best books for VBscript"
A big thick one, so you can whack yourself on the head with it.
|
|
|
|
|
do one thing ok
copy that page wich u want to export.(say page1.asp)
rename it (copy of page1.asp -> page2.asp)
write these line in page2.asp at top
<%
Response.ContentType = "application/vnd.ms-excel"
Response.Addheader "content-disposition", "inline; filename=YourFileName.xls"
%>
noe call page2 from page1
it will export to excel
try it
if it is working pls tell me.
bye
Thanks,
Ankur Bakliwal
|
|
|
|
|