Mvc widgets not registering

Posted by Community Admin on 04-Aug-2018 18:08

Mvc widgets not registering

All Replies

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



Hi,

My MVC widgets are no longer registering.

I have tried both manually creating them and creating them using Thunder - no option works. They worked last week fine.

Really starting to lose patience now with the amount of bugs I'm experiencing now.

I'm on version 6.2

Gary

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

Hello Gary,

 The MVC widgets are registered automatically when there is an attribute added before each controller class

[ControllerToolboxItem(Name = "MyWidget1", Title = "MyWidget1", SectionName = "MvcWidgets")]
    public class MyWidget1Controller : Controller
This automatic registration will work and also the controllers will work if the site assembly name contains the string "SitefinityWebApp" if the site assembly name was changed to something else that doesn`t contain "SitefinityWebApp" the widgets will not get registered.

To manually register MVC widgets go to Administration->Settings->Advanced->Toolboxes->Toolboxes->PageControls->Sections-><Choose a section> ->Tools-> click Create New button and fill in the textboxes with:

CLR Type Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy
Controller CLR Type: SitefinityWebApp.Mvc.Controllers.MyWidget1Controller (The type of the widget controller)
Name: MyWidget1
Title: MyWidget1

and Save Changes.

Regards,
Stanislav Velikov
Telerik
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 12-Jan-2014 00:00

I'm having issues in 6.3; MVC widgets are not registering at all.

I've got this:

[ControllerToolboxItem(Name = "Header", SectionName = "MVC", Title = "Header")]

...and this:

<add enabled="True" title="Infrastructure" ordinal="0" name="Infrastructure">
<add enabled="True" type="Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy" controllerType="SitefinityWebApp.Mvc.Controllers.HeaderController" title="Header" ControllerName="SitefinityWebApp.Mvc.Controllers.Header" visibilityMode="None" name="Header" />
</add>

....no widgets available in my templates. Please advise.

Posted by Community Admin on 12-Jan-2014 00:00

It's important to note that I've also done the instructions here...I was happy to see that I could add the widgets to the page, but now I get a NullReferenceException with the following call stack. I have absolutely zero code or logic in my widget, and I've followed the video tutorial *exactly*

[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Sitefinity.Mvc.MvcRequestContextBuilder.SetActionParams(RequestContext mvcContext, String[] originalParams, String actionName, Controller controller) +108
   Telerik.Sitefinity.Mvc.MvcRequestContextBuilder.BuildContext(String defaultControllerName, MvcHttpContext httpContext, RequestContext originalContext, Controller controller) +296
   Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy.ExecuteController() +424
   Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy.OnPreRender(EventArgs e) +45

Posted by Community Admin on 12-Jan-2014 00:00

More information on this one...you have to create a page before anything shows up...you also cannot insert your MVC Widgets into the same category of existing non-MVC widgets...

This is most assuredly a bug. I'm already regretting having recommended this platform to my client.

Posted by Community Admin on 14-Jan-2014 00:00

Not sure if this will help @Brenton, but...

I have experienced a scenario where I created and registered a widget using Thunder and afterward I didn't see it as a draggable widget within my site's backend. I ran through the process a couple of times with no errors, but no new widget either. I then went to "Administration --> Settings --> Advanced --> Toolboxes --> Toolboxes --> PageControls --> Sections --> MvcWidgets --> Tools" and confirmed that my widget was indeed registered in the backend, it just wasn't showing up in my browser. I cleared my browser's cache, and just to force the issue I shut down my browser and reset IIS. Then I reopened my browser, logged in and lo and behold there was my widget.  

Anyway, can you confirm whether widget was reg'd in the backend using the same scenario I described above? If it is, you may have to just clear your browser's cache and it'll start showing up afterward.

Hope that helps!

Posted by Community Admin on 15-Jan-2014 00:00

Hi,

Another cause of the problem where MVC widgets will get added to Sitefinty, but not registered is if the assembly version of the Sitefintiy site is changed from its default value "SitefinityWebApp" to another assembly name like "MySite" (here is a screenshot).

For Sitefinity MVC support its required the assembly to start with the string "SitefintiyWebApp", for example it can be SitefinityWebAppMySite, this way the auto registering of MVC widgets using ControllerToolboxItem attribute will work.

If this is the case please add SitefinityWebApp as starting string of the assembly name for the site (here is a screenshot).

Regards,
Stanislav Velikov
Telerik

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 15-Jan-2014 00:00

Hey David, thanks for helping out!

I created brand new projects, with different URLs 3 times. I then created the MVC controller and corresponding views, with proper namespace and attribute decorated onto the controller. All 3 times, the widget did not show up *until* I created at least one page in the web app.

In fact, it didn't show up at all unless I created a page first. My workflow was=> Create custom template based a default Sitefinity one => attempt to add my widget to a container...no widget!

Once I created a page using a default template, then followed the above workflow, I was able to see my widget.

BUGS!

Posted by Community Admin on 20-Jan-2014 00:00

Hi,

Testing the steps you provided to create a MVC widget (compile the project after adding the widget), create new Sitefinity page template, here is a video of the steps I have taken, this test was done at Sitefinity 6.3.5000 version, if you are using another version please let me know.

Regards,
Stanislav Velikov
Telerik

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 21-Jun-2015 00:00

Hi guys,

I had the same issue as Gary and later Brenton.  So firstly I couldn't register my own mvc widget to toolbox. As Stanislav wrote the cause was custom project name without word "SitefinityWebApp" so automatic registration is not working. I've done it manually according to his instructions and it appears on my toolbox. Nice ! ... not !

It didn't work beacuse I had the same problem as Brenton. My widget was returning NullReferenceException and I didn't know why ?

A few hours later... Me and my friend (Thx Rafal) figured out that manual way needs more information. When you have created node with your widget, you have to add into "Toolbox item parameters" new parameter called "ControllerName" and put there Key "ControllerName" and Value with the same string as before in field "Controller CLR Type" ( so path to your controller).

And this is how it should works !

P.S: At least for me ;)

 All the best !

This thread is closed