This project is read-only.

Widget Creation Problem

Topics: Troubleshooting, Writing modules
Feb 9, 2012 at 9:38 AM

Following an example of how to create widgets I found on the web, I tried creating a simple widget for use with our fairly new Orchard setup.

I followed the example perfectly, and successfully built the widget - flipped over to Orchard to enable the module, allocate the widget to a content part and tried inserting the widget to a zone.  All seemed well, but all the widget would do is print the Title of the widget in the zone that I'd specified.  I spent a few hours trying different things - got into a frustration situation where it would tell me that the widget needed to be updated - choosing to update resulted in it telling me that the widget had been successully updated, immediately followed by another message that the same widget needed to be updated...

I gave up on this and tried following the Maps widget creation (from the Orchard documentation) - the widget built correctly and I had the same problem - no matter what I tried, the widget just wouldn't render on the page - all I'd get was the Maps title appearing in place of the actual widget.

Not being a quitter, I downloaded the source code for the widget and thought I'd try with this (just in case I'd missed something from following the guide).  I added the extra migration step to turn the content part into widget - still no joy.

On another PC, I created a fresh Orchard install, and again downloaded the source code for the sample Maps widget - went through the same process, and the widget worked as I'd expected.  Repeating the same procedure on the other Orchard instance, and it still doesn't render the widget.  What am I doing wrong?

Interestingly, the same code for the widget I was trying to build was tried on another developers PC (using the same Orchard database), but this time after performing the update to the widget, they were not prompted for subsequent updates to be made.  Going back to my machine and deliberately changing the widget to prompt for an update to be made, didn't register the fact that one needed to be done by Orchard.

Anyone experienced this sort of behaviour, or can recommend a few things I can try?


Feb 9, 2012 at 4:28 PM

Something after your migration is probably failing in that particular instance, triggering an exception and rolling back the transaction. To find out what, you can look into app_data\logs and find a stack trace that corresponds to the time when it happens. You can also attach a debugger to the application and break on exceptions.