When working with the Sitefinity API and its various Content Managers, you need to make sure and consider the fact that after version 5.1, users have the ability to disable modules. Attempting to access the content manager of a disabled module will result in an exception such as this: [Exception: The configuration ‘EventsConfig’ is not […]
Category: Code Sample
We previously looked at how you can enforce minimum and maximum product quantities on the Sitefinity product details page. However, users can still override the quantities in the shopping cart, defeating the restrictions. Fortunately, the shopping cart template also includes a validation control for each item. By mapping this control to an external User Control […]
Adding a content block to a Sitefinity page with a Content widget (such as News, Events, Blogs, etc.) displays that content for both the master list and single item details view for the content. This video demonstrates how you can easily inherit from this control to make a hideable content block that only renders when […]
If you are working with the Sitefinity Pages API you can easily retrieve the Id of any page in the system. You might also be working with a custom or intra-site module, which has a static Guid property for the landing page. The Page object itself only has a UrlName property, which returns only the […]
When adding controls to a Sitefinity page programmatically, by default it’s going to set restricted permissions so that only users in the Administrators role can view them. You can easily change this so that the widget is installed with the default permissions it would get by being dragged onto the page with the following code: […]
When developing a Sitefinity Intra-Site Module you’ll likely be creating public widgets that your users will be dropping onto pages. Rather than relying on your users to manually add them to the toolbox, you can register these controls yourself during module installation. Here is a demo code snippet that shows an example of how you […]
The classification widgets in Sitefinity allows you to display the list of taxonomy names (such as categories or tags) used by content items in Sitefinity. You can specify a specific content type (even Dynamic Modules with this workaround) and to allow your visitors to filter the content items. Custom Blogs Taxonomy Control However, if you […]
The PageManager in Sitefinity has a method called CreateControl that is overloaded to allow both Compiled (dll) controls as well as simple User Controls (.ascx files) to be initialized and added to a Sitefinity page. Both overloads require a string containing the name of the ContentPlaceholder that will hold the control, which is defined in […]
When migrating to the latest Sitefinity from the old version 3.7, by default the original .aspx page extension remains intact. It is stored in the Extension property of the PageNode. You can remove (or change) this extension with this simple code snippet: RemoveSitefinityPageExtensions.cs on Gist