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 ExtensionsModulesModulesNavigateURL still doesn't workNavigateURL still doesn't work
Previous
 
Next
New Post
6/17/2013 2:49 PM
 

Thanks Mike, I might try that but I have a working solution... although it feels a bit hacky

    // I get the tabID for the selected page in my UrlControl control (ddlPageLinks), then search the TabInfo object for that item
    int tabId = Convert.ToInt32(ddlPageLinks.Url);
    var redirectTabInfo = TabController.GetPortalTabs(PortalId, this.TabId, true, false)
            .Where(t => t.KeyID == tabId)
            .Single();

    // then update the Settings with that KeyID, and the FullUrl
    modules.UpdateTabModuleSetting(this.TabModuleId, "DateRangeHyperLinkUrl", redirectTabInfo.FullUrl);
    modules.UpdateTabModuleSetting(this.TabModuleId, "DateRangeTabId", redirectTabInfo.KeyID.ToString());

Then when loading the View.ascx I have the Url to the selected page, and when loading the Settings.ascx control I have the TabId (for the UrlControl's "SelectedValue" property - actually called "Url")

 
New Post
6/17/2013 3:07 PM
 

Hello,

Personally, I'd generally recommend against storing a full URL. If you ever change anything in the site, it'll break. If you use the tabID, then you can rename the page, change it's position in the hierarchy, or change your domain name and it'll still work fine.

As I mentioned, I suspect that NavigateURL was just not working because when it gets a string, it assumes you're passing a control key. That's why your URL above has ctl/(some number) - it's getting the right tab ID - it's just a string so it thinks you're looking for a control key. 

I think that if you just do NavigateUrl(Convert.ToInt32(Settings("DateRangeTabId"))) then you'll be fine and it'll get the right URL.

Hope this helps,

Mike

 
New Post
6/17/2013 4:26 PM
 

Thanks again Mike. The requirements just changed, so now I have another question: what if the user uploads a file? Then the Url property of the UrlControl is something like 

FileID=12345

Which I wouldn't want to cast as an int. All I can think to do is
 - Strip out the "FileID=" portion
 - Store this as my "LinkUrl" or something in Settings
 - Store UrlType in my Settings
 - Use a switch statement on UrlType to determine what I'm going to do with the Id stored in LinkUrl

There must be an easier way.

 
New Post
6/17/2013 4:43 PM
 

And you were right about the int/string issue with NavigateURL! I cast the value as an int and it works. Thanks, that one was driving me crazy.

 
New Post
6/17/2013 6:15 PM
 
Hello,

With files, it's usually easiest to get them out of the LinkClick function. This returns a protected URL that can also handle logging (if setup/applicable).

DotNetNuke.Common.Globals.LinkClick("FileID=4") will give the url for that fileID.

Hope this helps,

Mike
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesNavigateURL still doesn't workNavigateURL still doesn't work


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