0 Replies - 422 Views - Last Post: 05 January 2016 - 09:18 PM Rate Topic: -----

#1 Nage  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 05-January 16

How to open my file in asp.net-vb.net

Posted 05 January 2016 - 09:18 PM

Hi after uploading files through upload document it display in list box from list box how to open my file. Is there an option to create hyperlink to this.Below is my code in vb.net I have another button to remove the file is it possible to open a file from list box.
Protected Sub UploadFile(ByVal sender As Object, ByVal e As System.EventArgs)
        If FileUpload1.HasFile Then
            Try
                FileUpload1.SaveAs("\\Destinationpath\testing\\" & _
                   FileUpload1.FileName)
                Label1.Text =
              FileUpload1.FileName & "<br>"
                ListBox1.Items.Add(System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName))
                'Dim files As List(Of ListItem) = New List(Of ListItem)
                'For Each filePath As String In filePaths
                '    files.Add(New ListItem(Path.GetFileName(filePath), filePath))
            Catch ex As Exception
                Label1.Text = "ERROR: " & ex.Message.ToString()
            End Try
        Else
            Label1.Text = "You have not specified a file."
        End If
    End Sub
    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs)
        'Files.RemoveAt(ListBox1.SelectedIndex)
        ListBox1.Items.Remove(ListBox1.SelectedItem.Text)
        Label1.Text = "File removed"
    End Sub

This post has been edited by andrewsw: 06 January 2016 - 07:44 AM
Reason for edit:: added missing [code][/code] tags


Is This A Good Question/Topic? 0
  • +

Page 1 of 1