MVC widgets not registering in the Toolbox - Bugs & Issues - Bugs & Issues - Progress Community
 Bugs & Issues

MVC widgets not registering in the Toolbox

  • MVC widgets not registering in the Toolbox
  • Hi all,

    I've found an issue with MVC widgets. After creating a widget, it's not registered in the Toolbox.
    Steps te reproduce:

    - Create a new SF 5.1 project.
    - Edit in VisualStudio.
    - Rename the project and the namespace to anything you like.
    - Build.
    - Run in VisualStudio, create the database, etc etc.
    - Stop the project. 
    - Add a new MVC view and controller. (or even use Thunder to create a default helloworld one for you.)
    - Build and run the project.
    - Try to add your new widget and you'll find that it isn't there even though you've declared it as a ControllerToolboxItem.

    The widgets do register only if you leave the original 'SitefinityWebApp' as it is.

    By the way. If you rename your project, because you don't want to end up with 30 customer assemblies that are all named 'SitefinityWebApp.dll', Thunder does not pay any attention to that. New MVC widgets you add with Thunder are placed in the original SitefinityWebApp namespace even though it's completely gone.
  • Dear Erik

    I have no idea about MVC but is not the kind of template you have important if a certain toolbox item will show up

    Pure MVC Template only will show MVC Toolbox Widget

    http://www.sitefinity.com/documentation/documentationarticles/developers-guide/sitefinity-essentials/how-does-sitefinity-use-asp.net-mvc/creating-mvc-based-sitefinity-widgets/adding-an-mvc-widget-to-the-toolbox 

    QUOTE
    Depending on the MVC mode that you are using in the page or template, the toolbox will either show only WebForms widgets, only MVC widgets or both.  
    UNQUOTE 

    So I assume it will be the other way around as well, That if you have a real Web Form Template MVC widgets would not show.

    Again I am clueless about MVC so this is a wilde guess.

    Markus
  • Markus,

    All you have to do to register an MVC widget is add a 'ControllerToolboxItem' to your controller.
    [ControllerToolboxItem(Name = "Home", Title = "Home", SectionName = "MvcWidgets")]

    Like I mentioned, as long as you leave the default 'SitefinityWebApp' namespace in place, it works perfectly. But when you apply your own namespace, MVC widgets fail to register.

    I'm familiar with the MVC only templates. That's not the issues.

    Regards,

    Erik
  • Same issue here, everytime when i setup a new sitefinity project, i change the default namespace "SitefinityWebApp" to something meaningful...
    Problem if you do so, the MVC Widget will not appear in the defined section, neither the section appears.
    @sitefinity : is there another way to register widgets? like registering ASP.NET User Controls directly in the toolbox.config
  • I see it's not just me.
    I'll just register a support ticket then.
  • Hi guys,

     We have identified the problem and will fix it. In the meantime, you can register your MVC widgets manually by customizing the following line to correspond to your project and adding it to the ToolboxesConfig.config file found in the App_Data/Configurations folder:

    <add enabled="True" type="Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy" controllerType="SitefinityWebApp.Mvc.Controllers.MvcWidget1Controller" title="MvcWidget1" ControllerName="SitefinityWebApp.Mvc.Controllers.MvcWidget1Controller" visibilityMode="None" name="MvcWidget1" />

    All the best,
    Atanas Valchev
    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
  • d90d0701-6656-4fe5-a742-f98f33f7298f_mvc.jpg
    i want to import MVC Views from external mvc c# project . Controllers and datamodels are encapsulated in Dlls.
    I have to import thats dlls in sitefinity proyect and copy and paste views in "shared" folder.
    Then i can´t add "[ControllerToolboxItem(" directive because are encapsulated.
    How can i register MVC widget in sitefinty toolbar
    Regards,
    Jose A.

  • Hello,

     Currently this is not supported. You can try  the registration method I shared below but I cannot guarantee that it will work.

    Regards,
    Atanas Valchev
    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
  • Thank you, that solved my problem after 2 hrs trying desperately 
  • Fixed?
  • Yea its fixed for me