7 votes

Razor Components

Helper extensions for razor support in Umbraco 4.x

This Library adds 2 new features to RazorLibraryCore (@Library.XXX())

1. RenderMacro

RenderMacro has 2 modes;

First can be called using

@Library.RenderMacro("MacroAlias", new { stringProp = "value", numberProp= 199, boolProp=true})

this will render a named macro from the back office.

Second can be called with a path to a razor macro script in the form

@Library.RenderMacro("~/macroScripts/scriptFile.cshtml", new { Property1 = "value", Prop2= "value2"})

this doesn't need to have been registered in the back office to work.

2. ImageUrl/ImageUrls

This call can be used to retrieve a one or more crop urls form a media picker property (also supports DAMP and embedded media xml)

@Library.ImageUrl("imagePropertyAlias", "aliasOfCropPropertyOnMediaNode", "cropName")

this calls falls back to using the umbracoFile property if needs must.

How to use

add @using Tocsoft.Umbraco.RazorComponents to the top of your razor file and you will then be able to use the helper methods.


This is compatible with normal Umbraco Razor macros an also from within views using the UmbraMVCo library



Package owner

Scott Williams

Scott Williams

Scott has 71 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions:

Package Information

  • Package owner: Scott Williams
  • Created: 19/06/2012
  • Current version 1.1
  • License MIT
  • Downloads on Our: 1.9K