Last post Apr 12, 2012 11:52 PM by KnowledgeisWealth
Apr 12, 2012 11:47 AM|KnowledgeisWealth|LINK
I would appreciate if the following question is answered.
Scenario: I am providing 3-4 dropdowns on page load by
If (IsPostBack <> True) Then
' Populate dropdown textfields from the database
Say "ddlFiles" is one of the dropdowns containing filenames as "file1", "file2" and so on. Now when the user selects say "file2", I want to download file2.
So, when I tried to debug it, since it was going to the page load again (do not know why, even though something is selected from this dropdown), I put an else for Post back there, and called selected_indexchanged function with file_value=2 as a parameter.
Now how do I have to modify the following statement to download file2.csv or file[any_number].csv?
Const remoteFile As String = "/folder/subfolder/file2.csv"
I tried this but something is wrong here:
Const remoteFile As String = "/folder/subfolder/file' " & file_value & "'.csv"
It says "Constant expression is required for "file_value". What is the problem?
I'm new to this, please help me.
Apr 12, 2012 11:55 AM|ignatandrei|LINK
remove the const and put Dim
Apr 12, 2012 11:01 PM|KnowledgeisWealth|LINK
It gives the following error:
The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
The reason, as I think (after debugging), should be the following:
So, it is constructing the above path as follows:
remoteFile = /folder/subfolder/file'140'.csv?
How should I modify to get it as just file140.csv in the above path? Please help.
Apr 12, 2012 11:51 PM|ignatandrei|LINK
remove the '
Apr 12, 2012 11:52 PM|KnowledgeisWealth|LINK
Okay, I just needed to remove the single quote and it worked.