1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Add a custom field with drop down list into news module

Add a custom field with drop down list into news module

5 posts, 0 answered
  1. Chris
    Chris avatar
    4 posts
    Registered:
    02 Jan 2012
    07 May 2012
    Link to this post
    I've had a hard time finding a simple solution to this.  Basically, I've created a custom module called "Issues".  It stores magazine issue dates, cover images, and links to pdf versions. 

    I now want to add a custom field to the news module called issue, which will display a drop down list of issues from the Issues module.  The drop down text should be the issue date, and the drop down value should be the id.  Can anyone help me with a simple solution to achieve this.  I've tried referencing this post http://www.sitefinity.com/blogs/radoslavgeorgiev/posts/12-02-27/creating_one_to_many_relationships_in_dynamic_modules.aspx, but I can't seem to successfully apply that to my case.

    Thanks,
    Ryan
  2. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    07 May 2012
    Link to this post
    ...that would be the article I was going to find you :/

    The only "easy" way is to wait for content linking...not sure if that's 5.1, 5.2 or later though.  I really really want this feature to be out of the box asap.
  3. Chris
    Chris avatar
    4 posts
    Registered:
    02 Jan 2012
    07 May 2012
    Link to this post
    Ugh, that's what I was afraid of.  I'm supposed to have this setup and working by the end of this week, so waiting for the next release isn't an option.

    Are there any users out there who have successfully achieved this?
  4. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    07 May 2012
    Link to this post
    Rados article is the way to do it...your quickest way to get this fixed is to provide a ticket with your project files ;)
  5. Richard Baugh
    Richard Baugh avatar
    201 posts
    Registered:
    22 Aug 2012
    08 May 2012
    Link to this post
    Steve is correct. The Array of Guids, which is the data type you would want to use, was only added to the module builder which is what Radoslav is referencing in the article. I know it isn't the best way, but you could go the opposite route. You could create the association from the Issues module and reference the news.

    Again not the proper relationship approach, but it would achieve your purpose. Another thing you could do would be to create a new taxonomy and use it as the link between the two. You could add the new taxonomy to the news and also the Issues. Make sure you use the same taxon on both. Then when you display the news, you would create an external template and then use the API to get a list of the issues with the same taxon that was applied to the news item. If you specify the ID of the page that you have the control to display the Issues, then you could link to the detail of the issue. Then you could create another external template for your Issue detail and do the reverse. Filter out the news based on the taxon of the Issue and link it back.

    This may not be the best solution, but it may help you continue on until a later release. The need for the external template is so you can add in some extra coding as the widget templates in Sitefinity do not allow you to add in extra code other than inline and this wouldn't work.

    One other bit of help if you go this route. As I mentioned, if you know the id of the page that will host the details of each, you can use the following helper method to generate the url of the item:
    Telerik.Sitefinity.Web.DataResolving.DataResolver.Resolve(DataItem, "URL", "", PageID)
    In the databinding of the news or issues, depending on the template, you can call this helper method. The DataItem is the current item being bound, and then PageID is the ID of the page that the item should link to.

    I hope this helps you out until the content linking comes out.
5 posts, 0 answered