Custom widgets not displaying on pages with news/event templ

Posted by Community Admin on 04-Aug-2018 15:42

Custom widgets not displaying on pages with news/event templates

All Replies

Posted by Community Admin on 02-May-2013 00:00

Hello all, hope somebody can be of some help :)

I have created a couple of pages, one for event details and another for news items, with the Events and News single item widgets on. These pages also have our own bespoke navigation widget and breadcrumbs.

Now, everything displays fine in the Sitefinity Editing view, but when I go to the live site and click through to the news page/events page, the news and events templates display fine, but our navigation and breadcrumbs do not. The navigation and breadcrumbs appear fine everywhere else on the site.

Any ideas? Tearing my hair out a bit with it :/

Thank you in advance,

Chris

Posted by Community Admin on 06-May-2013 00:00

Hello Chris,

Thank you for using our services.

To be able to provide assistance, could you please send us a sample of your custom navigation and breadcrumb controls, to be able to identify the problem?
 
Kind regards,
Boyko Nistorov
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 07-May-2013 00:00

Hi Boyko,

Many thanks for your reply.

I've since established it isn't just the navigation and breadcrumb controls that disappear - it is any custom widget that I design. For example, given the following basic, completely minimal MVC widget:

Controller (TestController.cs):

[ControllerToolboxItem(Name = "TestWidget", Title = "Test Widget", SectionName = "Custom Widgets")]
    public class TestController : Controller
   
        public ActionResult Index()
       
            return View("Test");
       
   

View (Test,cshtml):

<h2>Test View</h2>

.... the "Test View" heading appears fine in the Page designer, but then if I click through from a news article/event item on the live site it doesn't display.

Now, I know this is probably something to do with the news detail page being an auto generated page (eg, news-article/2013/05/04/test-article). I've probably missed something really obvious! Do you have any ideas why my template (headings, footers etc) is being displayed but not my custom MVC widgets?

Thanks again,

Chris

Posted by Community Admin on 09-May-2013 00:00

Hello Chris,

The problem is coming from the fact that by going to details view the URL does not match the index url. Please take a look at the following Blog post for a solution on this.

Regards,
Pavel Benov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 17-May-2013 00:00

Hi Pavel,

Many thanks for your reply. Interesting blog post and good solution, thank you!

Chris

Posted by Community Admin on 10-Jul-2014 00:00

In the comments for that blog post, a different solution (and a better one, it seems) is presented, add the following code to your custom MVC widget so that unknown routes will execute the Index() route.

protected override void HandleUnknownAction(string actionName)

    Index().ExecuteResult(ControllerContext);

This thread is closed