locked
Opening a File from a Link RRS feed

  • Question

  • Hi all,

    I have a scenario where I have a list of widgets. Each widget may have a document associated with it. The documents may be PDFs, Emails, Word documents and so on. The document is stored in the file system at a UNC location with format \\ServerName\ShareName\FolderName\DocumentName.EXT where EXT is the particular document extention, PDF, DOC and so on. So we have:

    WidgetsTable
    WidgetId
    WidgetDescription
    WidgetFileAttachment

    I want to have a form where I display the link to the file attachment in a grid so that clicking on it will cause the file to be opened by its associated program.

    How can I accomplish this? I do not want to add a button to the grid unless I have to.

    Thank you for any suggestions.

     


    Nigel Ainscoe

    Thursday, December 8, 2011 2:32 PM

Answers

  • I wasn't sure whether it'd work (as it wasn't what it was designed for) but the "Link" business type (in my free Luminous LightSwitch Types extension) will actually do what you're wanting to do.

    In a grid, with a Link business type property, I added a UNC link to an Excel spreadsheet, & saved it. When I click the link icon (on the right-hand side) it opened the file in Excel.


    Yann - LightSwitch Central
     
    Click here for FREE Themes, Controls, Types and Commands
     
    If you found my post helpful, please click "Vote as Helpful"
    If I answered your question, please click "Mark as Answer"
     
    By doing this you'll help people find answers faster.
    Thursday, December 8, 2011 11:42 PM
    Moderator
  • Your best bet would be to create a hyperlink custom control and import it in LightSwitch. You can bind the value to WidgetFileAttachment.

    If you do not wish to create you own custom control, you can download the DevExpress DXEditors for LightSwitch which has the Web Link control. You can download it from:

    http://visualstudiogallery.msdn.microsoft.com/8f0435fc-908a-4c09-a7c6-c72da74de5df

     

    HTH,

    Babar

    • Proposed as answer by babarismail Thursday, December 8, 2011 11:44 PM
    • Marked as answer by Nigel Ainscoe Friday, December 9, 2011 9:54 AM
    Thursday, December 8, 2011 11:44 PM

All replies

  • I wasn't sure whether it'd work (as it wasn't what it was designed for) but the "Link" business type (in my free Luminous LightSwitch Types extension) will actually do what you're wanting to do.

    In a grid, with a Link business type property, I added a UNC link to an Excel spreadsheet, & saved it. When I click the link icon (on the right-hand side) it opened the file in Excel.


    Yann - LightSwitch Central
     
    Click here for FREE Themes, Controls, Types and Commands
     
    If you found my post helpful, please click "Vote as Helpful"
    If I answered your question, please click "Mark as Answer"
     
    By doing this you'll help people find answers faster.
    Thursday, December 8, 2011 11:42 PM
    Moderator
  • Your best bet would be to create a hyperlink custom control and import it in LightSwitch. You can bind the value to WidgetFileAttachment.

    If you do not wish to create you own custom control, you can download the DevExpress DXEditors for LightSwitch which has the Web Link control. You can download it from:

    http://visualstudiogallery.msdn.microsoft.com/8f0435fc-908a-4c09-a7c6-c72da74de5df

     

    HTH,

    Babar

    • Proposed as answer by babarismail Thursday, December 8, 2011 11:44 PM
    • Marked as answer by Nigel Ainscoe Friday, December 9, 2011 9:54 AM
    Thursday, December 8, 2011 11:44 PM
  • @Babar - we must have been answering at the same time, lol. Now you know there's another custom control extension that does links. If you try it out for yourself & have any comments/suggestions, I'd be happy to hear them.
    Yann - LightSwitch Central
     
    Click here for FREE Themes, Controls, Types and Commands
     
    If you found my post helpful, please click "Vote as Helpful"
    If I answered your question, please click "Mark as Answer"
     
    By doing this you'll help people find answers faster.
    Friday, December 9, 2011 12:02 AM
    Moderator
  • @Babar, @Yann

    Thank you both for your replies, I will have a look at them. Yours might work best for me Yann, as it looks like my users may also be able to save new attachments by pasting the link in there.


    Nigel Ainscoe
    Friday, December 9, 2011 8:06 AM
  • I've found a problem with this because neither of these solutions work for me! Both of them look promising but do not launch the documents.

    I think this must be because the data source is a view and intrinsically read only.

    Oh well back to the drawing board.


    Nigel Ainscoe
    Friday, December 9, 2011 2:17 PM