I'm trying to setup a contact form using MVC partial views and a macro, but although I can see my form correctly when using the content editor when browsing the site as a normal user the form won't display. This is what I have so far:
Created a new partial view called RequestCallBack_Macro in Views\MacroPartials which simply calls to a controller:
Created a new macro called RequestCallBack with the MVC Partial View set to RequestCallBack_Macro
Created a Controller called ContactFormsSurfaceController, with a single child action called ShowRequestCallBackForm that returns a partial view called _RequestCallBackForm
Created a View model class that has a single string property to hold the RichText values
In the Razor view I'm then rendering the Rich text editor field using this:
When I add the Macro within the Umbraco content editor I can see the form being displayed correctly, however it is not displaying outside the editor. Does anyone know ow do I get this macro to display correctly?
Render Macro using MVC
I'm trying to setup a contact form using MVC partial views and a macro, but although I can see my form correctly when using the content editor when browsing the site as a normal user the form won't display. This is what I have so far:
@Html.Raw(@Model.BodyText)
However when the HTML renders this is what I get:
<!-- <?UMBRACO_MACRO macroAlias="RequestCallBack" /> -->
When I add the Macro within the Umbraco content editor I can see the form being displayed correctly, however it is not displaying outside the editor. Does anyone know ow do I get this macro to display correctly?
Any help is greatly appreciated
Try use @Umbraco.Field("bodyText")
As I'm using a custom ViewModel with no access to the @Umbraco helper, in the end I put this into my controller action:
umbraco.library.RenderMacroContent(src.BodyText, src.Id)
is working on a reply...