so I need some help with this. I can get the helper to render something, but it's not rendering the media item's umbracoFile property :-\... this macro works everywhere else on the site except through this helper call. It appears as if my macro params are not being populated correctly. Any Idea what is causing this?
The macro looks like this in the code-behind of the ascx:
public partial class WRO_InsertImage : System.Web.UI.UserControl
{
public int mediaItem { get; set; }
// snip other params
protected void Page_Load(object sender, EventArgs e)
{
// try to get media item
Media m = new Media(mediaItem);
if (m == null)
return;
// snip the rest for clarity
}
}
Rendering RTE with embedded macros in Razor
Anybody has any take on how to render richtext properties with embedded macros?
When I use @Model.bodyText it just gives me the embedded macro code (which makes good sense i suppose).
I could of course make a custom functionality that searches for embedded macros, but was wondering if umbraco already had this sort of functionality?
best regards
- Sune
Ok to answer my own question: @Html.Raw(umbraco.library.RenderMacroContent(Model.bodyText, Model.Id)) seemd to do the trick.
Thanks Fengelz, I found I had to do this:
Yeah.
Usually a good idea to stringify properties in razor. You never know what you'll be getting... :)
so I need some help with this. I can get the helper to render something, but it's not rendering the media item's umbracoFile property :-\... this macro works everywhere else on the site except through this helper call. It appears as if my macro params are not being populated correctly. Any Idea what is causing this?
The macro is configured like this:
The macro looks like this in the code-behind of the ascx:
I had the same problem as Sam and had to convert my user control to a Razor script instead to get the macro to render :(
I had the same problem trying to get oEmbed and insert video to work with uBlogsy
Redengine came to the rescue, as its razor based rather than a User control
http://our.umbraco.org/projects/website-utilities/redengine-video-embed
is working on a reply...