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

Forums / Developing with Sitefinity / MVC in Hybrid Mode

MVC in Hybrid Mode

3 posts, 0 answered
  1. Jennie
    Jennie avatar
    3 posts
    Registered:
    03 Sep 2012
    08 Apr 2013
    Link to this post
    Sitefinity 5.4
    I have a dynamic module called 'Apps'. These Apps are grouped into categories. 
    I have a page for each category - which I use to show dynamic single item detail content for an app in that Category. This is through the widget provided by the module builder.

    The url would be e.g. https://example.com/Store/Apps/Financial/Accounts
    where the category is "Financial" and the App identifier is "Accounts"

    I would like to use MVC in hybrid mode to include an additional custom MVC widget on the page, but I'm having trouble pulling this all together. My controller action fires correctly on a static page, but not on my dynamic app page.
    If I browse to https://example.com/Store/Apps/Financial?App=Accounts, then my controller fires, but then I don't get the other detail content through the sitefinity dynamic widget. 

    The signature for my controller action method is...

       [ControllerToolboxItem(Name = "GetApp", Title = "Get This App", SectionName = "xxx")]
        public class GetAppController : Controller
        {
            private GetAppViewModel model;

            public ActionResult Index(string id)
            { ...
            }

    I've added a Global.asax to add a route for my action, with code behind as....


            void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs args)
            {
                if (args.CommandName == "RegisterRoutes")
                {
                    var routes = ((EnumerableQuery<RouteBase>)args.Data).ToList();
                    var newRoutes = new RouteCollection();
                    newRoutes.MapRoute("Apps", // Route name
                           "Apps/{product}/{id}", // URL with parameters
                           new {controller = "GetApp", action = "Index", id = UrlParameter.Optional }); 
                    routes.Add(newRoutes[0]);
                }
            }

    Any suggestions gratefully received.
  2. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    06 Dec 2016
    10 Apr 2013
    Link to this post
    Hi,

    We have answered you on the supported ticket you have opened. You could share our answer with the community if you want.

    Greetings,
    Stefani Tacheva
    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
  3. Jennie
    Jennie avatar
    3 posts
    Registered:
    03 Sep 2012
    17 Apr 2013 in reply to Stefani Tacheva
    Link to this post
    Thank you Stefani. I also received assistance from Vesselin Vasilev who directed me to Stanislav Velikov's blog post how-to-display-mvc-widget-in-detail-views-of-content-items. This post provided exactly the info that I needed.
3 posts, 0 answered