Mvc widgets not registering
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
The MVC widgets are registered automatically when there is an attribute added before each controller class
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")]
<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" />
....no widgets available in my templates. Please advise.
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.OnPreRender(EventArgs e) +45
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.
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!
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).
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.
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.
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 !