@using System.Diagnostics @using umbraco.MacroEngines @inherits umbraco.MacroEngines.DynamicNodeContext
@{ String thisis = ""; DynamicNode video = null; DynamicNodeList listOfVideos = null; if (@Model.NodeTypeAlias == "VideoFAQ") { thisis = "one particular video"; video = @Model; listOfVideos = @Model.Ancestors("VideoFAQPage").Items[0].Children.Where("NodeTypeAlias == \"VideoFAQ\""); } else if (@Model.NodeTypeAlias == "VideoFAQPage") { thisis = "A Page containing lot of videos."; video = @Model.VideoFAQ.Items[0]; listOfVideos = @Model.VideoFAQ; } @video.HtmlMarkup }
I don't know if it matters a lot, but I am loading the macro (as i saw in the Cultiv Razor examples...by using the filelocation attribute of the Umbraco:macro tag)
I think it has to do something about the way these assigments are taking place, I am very new to .net development, but as far as I know (and I hope I am right)... while creating @Model umbraco does something to the DynamicNode (like add some methods and properties to the runtime object) and when In the code I am trying to reassign these to other variables (which are basically DN and DNL), these magic things are not coming to me, it seems that they are being assigned by a copy and not by reference. Some syntatic sugar goes missing...
The reason I say so is because the following seems to be working fine.
@Html.Raw(@video.GetPropertyValue("htmlMarkup"));
And the following Won't work
@Html.Raw(@video.HtmlMarkup)
I am also getting a Red Squiggly line with the following error message in visual studio
umbraco.MacroEngines.DynamicNode does not contain a definition for HtmlMarkup and no extension method 'HtmlMarkup' accepting a first arguement of type 'umbraco.MacroEngines.DynamicNode' could be found (are you missing a using directive or an assembly reference)
custom property not found after assignment
Hello,
I am new to Umbraco/Razor (and to .net development also please bear with me for a moment), the following code is a razor macro.
When I try to do this
HtmlMarkup is a property defined on the Document Type , the same works if I do it the @Model.HtmlMarkup way.
There comes an error, My guess is that it is because the way I am constructing this.
can someon please tell me what is going on.... and if there is a better way to do it.
Hi Arum,
What error message are you getting?
Can you try addding
to your code
//fuji
I am still getting the error.
The code is now.
I don't know if it matters a lot, but I am loading the macro (as i saw in the Cultiv Razor examples...by using the filelocation attribute of the Umbraco:macro tag)
Hi Arun,
Can you try removing the @ symbol within the if statment so as
Hi Fuji,
I tried that and it is not working.
I think it has to do something about the way these assigments are taking place, I am very new to .net development, but as far as I know (and I hope I am right)... while creating @Model umbraco does something to the DynamicNode (like add some methods and properties to the runtime object) and when In the code I am trying to reassign these to other variables (which are basically DN and DNL), these magic things are not coming to me, it seems that they are being assigned by a copy and not by reference. Some syntatic sugar goes missing...
The reason I say so is because the following seems to be working fine.
And the following Won't work
I am also getting a Red Squiggly line with the following error message in visual studio
Cheers,
Arun
is working on a reply...