Custom widgets not displaying on pages with news/event templates
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
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
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
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,Hi Pavel,
Many thanks for your reply. Interesting blog post and good solution, thank you!
Chris
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);