How to open various files?

Last post 08-06-2007 3:23 PM by bbudz. 5 replies.

Sort Posts:

  • How to open various files?

    08-06-2007, 12:31 PM
    • Loading...
    • bbudz
    • Joined on 08-02-2007, 3:34 PM
    • Posts 97

    Hi,

    I'm fairly new to ASP.NET 2.0 and I'm sure there is a simple solution to my problem.

    I have to make an application that searches for files and then allows the user to click the name of the file in order to view it in the web browser.  The searching for the file was easy (I used the DirectoryInfo's GetFile method) and I originally had them listed in a GridView.  I tried creating a hyperlink column to allows the user to click it and to display the file, but I have no clue as how to open and display the file. 

    This is my GridView

    1    <asp:GridView id="resultGridView" runat="server >
    2         <Columns>
    3              <asp:HyperLinkField HeaderText="File Name" DataTextField="Name" DataNavigateUrlFields="Name" />
    4              <asp:BoundField HeaderText="Size" DataField="Length" />
    5         <Columns>
    6    </asp:GridView>
    

    Any kind of help would be great. If you have a code solution VB would be preferred.

    Thanx,
    Bart
  • Re: How to open various files?

    08-06-2007, 2:22 PM
    • Loading...
    • DkUltra
    • Joined on 03-19-2007, 2:06 PM
    • South Dakota / Nebraska
    • Posts 356

    We need more information, what are the file types?

    If the file is just text please see http://forums.asp.net/t/1142949.aspx

    Hope this helps

    DK

  • Re: How to open various files?

    08-06-2007, 2:40 PM
    • Loading...
    • bbudz
    • Joined on 08-02-2007, 3:34 PM
    • Posts 97

    The files are actually engineering drawings with the extension .cgm and .pdf.  The .cgm is an extension for a viewer that the company uses and is installed on all the machines.  I can open the .pdf files fine but I can't open the .cgm files.

    Thanx,
    Bart

  • Re: How to open various files?

    08-06-2007, 3:14 PM
    • Loading...
    • bbudz
    • Joined on 08-02-2007, 3:34 PM
    • Posts 97

    Nevermind, I think I got it.  I think I can use a HttpHandler to open it.  Please let me know if you have any other suggestions.

    Thanx for the link DK it still came in handy.

    Thanx,
    Bart

  • Re: How to open various files?

    08-06-2007, 3:14 PM
    • Loading...
    • DkUltra
    • Joined on 03-19-2007, 2:06 PM
    • South Dakota / Nebraska
    • Posts 356

    Does the viewer have a DLL file that visual studio can set a refference to or a web addon ? 

    DK

     

  • Re: How to open various files?

    08-06-2007, 3:23 PM
    • Loading...
    • bbudz
    • Joined on 08-02-2007, 3:34 PM
    • Posts 97

    Wow!  Don't I feel kind of dumb now.  Thanx DK that was exactly what I needed.  It does have a DLL file so I can open it fine now.  Thank you.

    Thanx,
    Bart

Page 1 of 1 (6 items)
Microsoft Communities
Page view counter