Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDisplay images LinkClick.aspx?fileticketDisplay images LinkClick.aspx?fileticket
Previous
 
Next
New Post
3/2/2013 12:43 PM
 
Ok - this all sounds reasonable, but is well beyond my knowledge. Sorry.

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
www.dynamisys.co.uk
 
New Post
3/2/2013 3:12 PM
 

The problem is in the generation of the URL for the LinkClick.aspx fileserver handler. Note that the Content column value returned from your data source is of MS SQL Server datatype image and is NOT the proper value for fileticket querystring parameter passed to the LinkClick handler. Because the fileticketid querystring parameter needs to be set to an encrypted string of the form "fileid=256", I would pass the FileID column value returned from your datasource to a helper method something like this (untested and no error handling included):

public string MakeLinkClickURL(string fileID)
{
        return DotNetNuke.Common.Globals.LinkClick("fileid=" + fileID, TabId, ModuleId)
}

Note that TabId and ModuleId are available as properties in your module control which should inherit from DotNetNuke.Entities.Modules.PortalModuleBase.

An even better helper method would make use of the DotNetNuke.Services.FileSystem.FileManager to determine the file url building it as either a direct url to a file in a Standard folder or as a LinkClick.aspx handler to a file in a Secure (or other folder mapping type) folder. Something like this - again without needed error handling:

public string MakeFileURL(string fileID)
{
     var fileInfo = DotNetNuke.Services.FileSystem.FileManager.Instance.GetFile(Convert.ToInt32(fileID));
     if (fileInfo == null)
     {
          // return a bad or default image url as appropriate
     }
     else
     {
          return DotNetNuke.Services.FileSystem.FileManager.Instance.GetUrl(fileInfo);
     }
}

The image tag in your DataList markup will then look something like this (space added to opening/closing tag to post to this forum):

< img alt="" src="MakeFileURL(Eval("FileID") %>" / >

Finally, make sure that View permissions for the permitted user role(s) that can access the images have been applied to the Secure Folder in FileManager or your code or they will get an Access Denied error.


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
3/3/2013 9:27 AM
 
William,

Thank you very much!

Regards
Mike
 
New Post
12/10/2014 3:16 PM
 

Thanks a lot William, for taking the time of giving such a well explained answer :D

You are a Master :D

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDisplay images LinkClick.aspx?fileticketDisplay images LinkClick.aspx?fileticket


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out