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

Forums / Bugs & Issues / MVC widgets not registering in the Toolbox

MVC widgets not registering in the Toolbox

11 posts, 0 answered
  1. Erik
    Erik avatar
    10 posts
    Registered:
    31 Jul 2012
    22 Aug 2012
    Link to this post
    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.
  2. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    22 Aug 2012
    Link to this post
    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
  3. Erik
    Erik avatar
    10 posts
    Registered:
    31 Jul 2012
    22 Aug 2012
    Link to this post
    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
  4. Pascal
    Pascal avatar
    9 posts
    Registered:
    22 Nov 2010
    22 Aug 2012
    Link to this post
    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
  5. Erik
    Erik avatar
    10 posts
    Registered:
    31 Jul 2012
    22 Aug 2012
    Link to this post
    I see it's not just me.
    I'll just register a support ticket then.
  6. Atanas Valchev
    Atanas Valchev avatar
    414 posts
    Registered:
    04 Jan 2016
    23 Aug 2012
    Link to this post
    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
  7. Jose Antonio de Alarcon
    Jose Antonio de Alarcon avatar
    10 posts
    Registered:
    29 Jun 2009
    08 Nov 2012
    Link to this post
    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.

  8. Atanas Valchev
    Atanas Valchev avatar
    414 posts
    Registered:
    04 Jan 2016
    13 Nov 2012
    Link to this post
    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
  9. Bishoy
    Bishoy avatar
    27 posts
    Registered:
    15 Aug 2013
    14 Nov 2013 in reply to Atanas Valchev
    Link to this post
    Thank you, that solved my problem after 2 hrs trying desperately 
  10. Simisi
    Simisi avatar
    1 posts
    Registered:
    24 Sep 2012
    18 Feb 2014 in reply to Atanas Valchev
    Link to this post
    Fixed?
  11. Bishoy
    Bishoy avatar
    27 posts
    Registered:
    15 Aug 2013
    18 Feb 2014 in reply to Simisi
    Link to this post
    Yea its fixed for me
11 posts, 0 answered