MVC widgets not registering in the Toolbox

Posted by Community Admin on 04-Aug-2018 05:59

MVC widgets not registering in the Toolbox

All Replies

Posted by Community Admin on 22-Aug-2012 00:00

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.

Posted by Community Admin on 22-Aug-2012 00:00

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

Posted by Community Admin on 22-Aug-2012 00:00

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

Posted by Community Admin on 22-Aug-2012 00:00

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

Posted by Community Admin on 22-Aug-2012 00:00

I see it's not just me.
I'll just register a support ticket then.

Posted by Community Admin on 23-Aug-2012 00:00

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

Posted by Community Admin on 08-Nov-2012 00:00

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.

Posted by Community Admin on 13-Nov-2012 00:00

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

Posted by Community Admin on 14-Nov-2013 00:00

Thank you, that solved my problem after 2 hrs trying desperately 

Posted by Community Admin on 18-Feb-2014 00:00

Fixed?

Posted by Community Admin on 18-Feb-2014 00:00

Yea its fixed for me

This thread is closed