Hello,
In my webform I have a listbox that is populated with document names that it gathers from a folder on the server.
there are various document types excel pdf, word etc..
Can I open them in the web browser when hey are selected in the list?
I have tried

response.redirect("file_path")

but i just get 'internet explorer cannot display the webpage'

I've also tried

File.OpenRead("file_path")

but that only opens it in the background not open it to view!

If possible i would like to be able to open the file in a new page in the browser!

Thanks for any advice!!

Iain

I have managed to get files to open with

Response.TransmitFile(opendoc)

It looks like this is opening pdf files only.
it is opening it in the same window
i really want it to open in a new window!

You should try the JavaScript code.

<asp:ListBox ID="ListBox1" runat="server"
             onchange="window.open(this.value);">
            <asp:ListItem>file1.pdf</asp:ListItem>
            <asp:ListItem>file2.pdf</asp:ListItem>
</asp:ListBox>

I have my listbox populated by the following vb command

 Dim TheDirectory As New IO.DirectoryInfo("Q:\Documents\BM401582")

 lbDocs.DataSource = TheDirectory.GetFiles.Select(Function(fi As IO.FileInfo) fi.Name).ToList()

 lbDocs.DataBind()

will i still be able to use the code above?