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

Forums / Project Feather / custom MVC widget template not working

custom MVC widget template not working

14 posts, 1 answered
  1. Tim
    Tim avatar
    13 posts
    Registered:
    19 Nov 2012
    22 Apr 2015
    Link to this post
    I followed to the letter the directions found at https://github.com/Sitefinity/feather/wiki/Work-with-widget-templates for adding a custom template for use with the MVC news widget.  However, whenever I attempt to change the template used for a news widget on one of my pages, the template I created is not in the drop down list.  Has anyone out there successfully added their own custom template for a MVC news list?  If so, please help.  I am finding that Telerik's tutorials for Sitefinity and Feather are less than accurate and generally unhelpful.
  2. Mariush
    Mariush avatar
    43 posts
    Registered:
    08 Aug 2014
    23 Apr 2015 in reply to Tim
    Link to this post

    Hi Tim,

    I am sorry the guide did not work for you. I tried the same article and recorded a short video with the main steps. Everything worked as expected.

    http://www.screencast.com/t/yvmWb5uRTi0

    Please let me know if it still doesn't work for you or your have encountered problem with other of the guides.

     Best,

    Mariush

  3. Tim
    Tim avatar
    13 posts
    Registered:
    19 Nov 2012
    23 Apr 2015 in reply to Mariush
    Link to this post

    Mariush,

    Thank you for your reply.  I viewed your screencast, and I did exactly what you did.  The custom template simply does not display in the dropdown.  Is this possibly because I am running the trial?

  4. Mariush
    Mariush avatar
    43 posts
    Registered:
    08 Aug 2014
    23 Apr 2015 in reply to Tim
    Link to this post

    No, it can't be the trial.

    Have you tried with some other widget? If not, can you try with let's say, the Navigation widget?

    Also, please double check your page is based on the package you are modifying. I.e. if your page uses Foundation.default template, you should work in ResourcePackages\Foundation\MVC\Views\[widgetname]

  5. Tim
    Tim avatar
    13 posts
    Registered:
    19 Nov 2012
    23 Apr 2015 in reply to Mariush
    Link to this post
    The fact that I am just testing Sitefinity and am not very familiar with its design paradigm and such is likely why I am having trouble.  I have defined a custom layout in Visual Studio to use for my pages, so, based on your last post, apparently I have not based my layout on any of the packages.  Could you point me toward a tutorial about using the built in packages when defining a custom layout?
  6. Mariush
    Mariush avatar
    43 posts
    Registered:
    08 Aug 2014
    23 Apr 2015 in reply to Tim
    Link to this post

    The place you put the layout on the file system defines whether it is part of the package and which one. 

    See this one for a general explanation about packages and let me know if you have more questions:

     https://github.com/Sitefinity/feather/wiki/Page-templates-based-on-layout-files-with-Feather

  7. Tim
    Tim avatar
    13 posts
    Registered:
    19 Nov 2012
    23 Apr 2015 in reply to Mariush
    Link to this post
    So, to clarify, if I want to base my layout  on the Bootstrap package, I need to create my layout under the "ResourcePagkages/Bootstrap/MVC/Views/Layouts" folder instead of the "MVC/Views" folder right under the solution root?
  8. Mariush
    Mariush avatar
    43 posts
    Registered:
    08 Aug 2014
    23 Apr 2015 in reply to Tim
    Link to this post
    Yes. Once you create the file (let's say it called TimsLayout.cshtml), Sitefinity will register it as a custom page template with name Bootstrap.TimsLayout.cshtml and any pages using that page template will be using that layout.
    Answered
  9. Tim
    Tim avatar
    13 posts
    Registered:
    19 Nov 2012
    23 Apr 2015 in reply to Mariush
    Link to this post

    Mariush,

     Thank you so much for your help.  You have been more helpful than anything I have read from Telerik.  Using the info you provided, I was able to deduce that I could create a News folder under the MVC/View folder and place my template in there.  That worked.  It is good to know that I can just move the views I created to any of the included package folder structures and inherit their templates.

  10. Mariush
    Mariush avatar
    43 posts
    Registered:
    08 Aug 2014
    23 Apr 2015 in reply to Tim
    Link to this post
     I am happy it worked. We will be working to improve the documentation and the initial experience for new users. If you have feedback about other topics that are not explained clear enough, please let me know.
  11. Tim
    Tim avatar
    13 posts
    Registered:
    19 Nov 2012
    24 Apr 2015 in reply to Mariush
    Link to this post

    Mariush,

     Now that I have the template working, I'm trying to display a custom field that is an image.  Can you please point me to a tutorial that shows how to accomplish that in a custom MVC widget template?

  12. Mariush
    Mariush avatar
    43 posts
    Registered:
    08 Aug 2014
    27 Apr 2015 in reply to Tim
    Link to this post

    Hi,

    Here's a guide how to add a related news item:

    https://github.com/Sitefinity/feather/wiki/Add-related-data-to-News-widget

    In your case, you need to add related media of type Image and access its properties in the template. To see the full list of properties of the Image item, please refer to Sitefinity API reference.

    If you rather prefer a working sample, create a Dynamic content type with an image field. Sitefinity will auto-generate a widget with templates for it. Then go to Design -> Widget templates and have a look how your related data image field has been rendered in the the detail template for that widget.

    I hope this helps,

    Mariush

     

     ​​

  13. Dirk
    Dirk avatar
    1 posts
    Registered:
    24 Jan 2011
    26 Jun 2015 in reply to Mariush
    Link to this post

    Hey Mariush,

     

    I have an issue like that as well.

    I Created a fully new Module with the Module Builder.

    On custom field is an Imagefield and it renders it fine in the DetailsView BUT i also want to have the Picture in the ListView!

    How can i handle this?

  14. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    22 Sep 2016
    01 Jul 2015
    Link to this post
    Hi Dirk,

    When you have created Dynamic content type with an image field  the Sitefinity will auto-generate a widget with templates for it. Then go to Design -> Widget templates and have a look how your related data image field has been rendered in the the detail template for that widget. Than add that code to your list template.

    Note that in the Details view the model is an item but in the List view it is a list of Items, so you need to slightly change the code (screenshot).

    I hope this helps.

    Regards,
    Svetoslav Manchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
14 posts, 1 answered