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 ExtensionsModulesModulesIssues with URLControlIssues with URLControl
Previous
 
Next
New Post
8/15/2010 8:53 PM
 
Just a guess here without seeing where in your code you are setting the Url property of the Url control:

Are you certain that the selected file url is getting saved correctly to the database?

If the assignment

ctlLinkUrl.Url = MyObject.LinkUrl;

which I assume is being made in your Page_Load handler, is not being done within a not IsPostback block such as

if (Page.IsPostback == false) {
      ctlLinkUrl.Url = MyObject.LinkUrl;
      // other code
}


the selected file value is always going to be overwritten by the previous value (which will be the first item in the file dropdown)  each time you click "Update" resulting in the first filename in the dropdown not the selected file value being written to the database.

Also, I recall that the Url control requires you to either pass into it the ModuleId or that a mid=### key/value pair be included in the module control's querysting.


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
8/15/2010 10:24 PM
 
I had a look, and it is saving correctly.  This is what the form source has:

<select name="dnn$ctr649$EditCycle$ctlImageUrl$cboFiles" class="NormalTextBox" id="dnn_ctr649_EditCycle_ctlImageUrl_cboFiles" style="width: 250px;">
<option selected="selected" value="395">banner_image_1.jpg</option>
<option value="396">banner_image_2.jpg</option>
 <option value="397">banner_image_3.jpg</option>
</select>
and this is what is in the database for that entry:
FileID=396

So, as far as i can tell, it is saving properly.  Now, the code is within a postback block as you guessed, however the flow of the process as follows:
click add -> add/edit form -> click update -> back to original page with module in it -> click edit -> error occurs

So, that it is in the postback block of code should not affect it as it is reloading the page on a get, not a postback.

Any other thoughts? Really apprecieate the help!
 
New Post
8/16/2010 9:24 AM
 
Seeing that the database entry was "FileID=396" just reminded me that while the UrlControl's Url property returns "FileID=####" and it is that value which gets stored in the database, when setting the Url property you must pass in a filepath relative to the portal home directory. For example, "MyFolder/MyFilename.jpg".

To convert the FileID which is stored in the database, you will need to either in your database query do a join with the Files table on the FileID or else call the GetFileById method of the FileController class to resolve the FileID to a relative path. I prefer the former to avoid a second hit on the database.

Take a look at one of the core stored proceedures or views in which a folder/filename path is returned as one of its columns. For example vw_Tabs view should do this for the IconFile column.

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
8/16/2010 12:21 PM
 
Actually, William's advice would still apply.  Try wrapping your page load code in a "Not Page.IsPostback" and I would be surprised if your problem still exists.

Will Strohl

Upendo Ventures Upendo Ventures
DNN experts since 2003
Official provider of the Hotcakes Commerce Cloud and SLA support
 
New Post
8/16/2010 7:09 PM
 
ok... I have created the following function to return the URL:

private string GetFileURLForControl(string URLToConvert)
{
    if (
        ContentCycleController.ConvertToUrlType(
            DotNetNuke.Common.Globals.GetURLType(URLToConvert)) == "F")
    {
        FileController x = new FileController();
        //x.
        //ctlLinkUrl.UrlType = ContentCycleController.ConvertToUrlType(DotNetNuke.Common.Globals.GetURLType(Model.CycleContent.LinkUrl));
        var ss = URLToConvert.Split('=');
        var myf = new DotNetNuke.Services.FileSystem.FileController();
        var f = myf.GetFileById(Convert.ToInt32(ss[1], CultureInfo.InvariantCulture),
                                ModuleContext.PortalId);
        return f.RelativePath;
    }
    return URLToConvert;
}
and I use it here:

ctlImageUrl.Url = GetFileURLForControl(Model.CycleContent.ImageUrl);

I am still getting the same issue.  I am getting the correct relative path "Images/banner_image_2.jpg" but it is still showing banner_image_1.jpg in the drop down. (Note: I will update the database call when i get it working, i agree, one hit to that would be best).  Any other thoughts??  Am i doing something weird?

Thanks
Lee
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesIssues with URLControlIssues with URLControl


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