Products

Solutions

Resources

Partners

Community

About

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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Linking to tabs, files, users, etc without LinkClick.aspx?Linking to tabs, files, users, etc without LinkClick.aspx?
Previous
 
Next
New Post
3/14/2008 4:28 PM
 

I have been using the LinkClick method (DotNetNuke.Common.Globals.LinkClick) for linking to files, etc when I use the UrlControl to pick files to associate with records.  While it has been working just fine all this time, I really don't like the links that it generates.  I'm just wondering if there is another way to link to files (based on a file ID) and other things so the URL is a bit more "friendly".

Anybody know of a way?


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
New Post
3/14/2008 4:38 PM
 

The advantage of LinkClick is that it records each click.  I don't think there's any way baked into the core to get the LinkClick records without using ugly LinkClick URLs.

That said, if you don't care about recording clicks, DotNetNuke.Common.Globals.NavigateUrl is what you'll want for links to tabs.  I'd have to take a quick look at the code to see if there's a simple way to link to users and files.

Hope it helps,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
3/14/2008 5:05 PM
 

When I have not needed the link click counting, I've used code similar to the following to obtain the file path from a single FileID:

Dim fID As Integer = 135
Dim fc As New DotNetNuke.Services.FileSystem.FileController
Dim fi As Services.FileSystem.FileInfo = fc.GetFileById(fID, PortalId)
If Not fi Is Nothing Then
      Dim ps As DotNetNuke.Entities.Portals.PortalSettings = PortalController.GetCurrentPortalSettings
      Dim relPath As String = ps.HomeDirectory & fi.Folder & fi.FileName
      Dim absPath As String = HttpContext.Current.Server.MapPath(relPath)
      'do whatever you want with the paths here
End If

When I have needed to databind to a large number of file paths - usually as hyperlinks, I've directly accessed the Files table from my SQL - probably not the best thing to do as the table structure might change, it is more efficient than repeated calls to GetFileFromID and other core methods.


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/14/2008 5:09 PM
 

After a quick glance through the code, it appears that LinkClick is the only way of getting to a file.  You can, however, link to a user just by supplying False for the TrackClicks parameter of LinkClick and it will return a NavigateUrl style URL.

Also, you may want to look to seeing if Friendly URLs or Human Friendly URLs are turned on for your site, to get prettier URLs from NavigateURL.

Hope it helps,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
3/15/2008 9:52 AM
 

Thanks to both of you for your suggestions.  I had thought about directly accessing the FileIDs from the database, but decided against that.  I don't really *need* friendlier urls, just think the LinkClick ones are pretty ugly.  In the end, all I really care is that they work. :)

Thanks again!


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Linking to tabs, files, users, etc without LinkClick.aspx?Linking to tabs, files, users, etc without LinkClick.aspx?


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