This project is read-only.

New module - Blocks

Topics: Announcements
Jan 25, 2012 at 3:49 PM

Blocks lets you define areas of editable content in any view. You can use Razor HTML delegates to write the default content, so you have designer support (intellisense / syntax highlighting) for the HTML, instead of just passing in a text string.

This is really useful for allowing pages like Registration, LogOn, etc. to be customisable from admin.

The Blocks are fully-fledged content items ... so you can even add other parts to them.



Jan 26, 2012 at 2:26 PM
Edited Jan 26, 2012 at 2:34 PM


I was just about to try your module but I encountered an error when enabling the Blocks part. I installed it on a clean WPI version of Orchard.


Server Error in '/' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS1061: 'Orchard.ContentManagement.IContentQuery<Orchard.ContentManagement.ContentItem,Orchard.Core.Common.Models.IdentityPartRecord>' does not contain a definition for 'WithQueryHintsFor' and no extension method 'WithQueryHintsFor' accepting a first argument of type 'Orchard.ContentManagement.IContentQuery<Orchard.ContentManagement.ContentItem,Orchard.Core.Common.Models.IdentityPartRecord>' could be found (are you missing a using directive or an assembly reference?)

Source Error:


Line 34:                                                            IsolationLevel = IsolationLevel.ReadUncommitted
Line 35:                                                        })) {*/
Line 36:                     var find = _contentManager.Query("Block").Where<IdentityPartRecord>(i => i.Identifier == name).WithQueryHintsFor("Block").List().FirstOrDefault();
Line 37:                     if (find == null) {
Line 38:                         // Create new block


Jan 26, 2012 at 3:01 PM

Are you using Orchard 1.3 or greater?

Jan 26, 2012 at 3:21 PM
Edited Jan 26, 2012 at 3:23 PM

I'm using the Orchard version that is available via WebMatrix...



Dashboard says: v.

Jan 26, 2012 at 5:01 PM

Oh ... I used the QueryHints feature from Orchard 1.4 to slightly optimise the query. I'll release a 1.3-compatible version. If you want to fix it locally you can literally just delete .WithQueryHintsFor("Block"), it's purely an optimisation but it'll make little difference.

Jan 29, 2012 at 11:21 AM

Ive gotta say Pete, I always love the names of your modules!!! :)

Mar 22, 2013 at 4:49 AM
I am having trouble using this. I've installed it on Orchard 1.6. It compiles fine and it even creates content records when I've called it from within a View. However, I can't see where to edit the content blocks from in the admin pages. The blocks simply do not show up in the list of content items.

Is this compatible with 1.6? Do I need to change some of the settings on the Content Type?

Mar 23, 2013 at 8:16 AM
Contact the author maybe?