@{ var Treasure = @Model.NodeById(1101); <div class="akram-treasure"> @foreach(var node in @Treasure.Children) { dynamic link = new DynamicMedia(@node.akramTreasureThumbImage); string str = @node.content; <div class="qitem"> <a href="@node.NiceUrl" target="_blank"><img src="@link.umbracoFile" alt="@node.PageHeading" title="@node.PageHeading" width="126" height="126"/></a> <span class="caption"> <h4>@node.PageHeading</h4> <p>str.Substring(0,index+1)</p> </span> </div> }
</div>
}
this gives error on page as follows
Error loading Razor Script AkramTreasure.cshtml The best overloaded
method match for
'umbraco.MacroEngines.DynamicMedia.DynamicMedia(umbraco.MacroEngines.DynamicBackingItem)'
has some invalid arguments
I am using umbraco 4.7.1. Now, it is not showing razor error. So ur solution was a bit helpful. But It is not fetching image.
In firebug it shows the line .... <a href="@node.NiceUrl" target="_blank"><img src="@link.umbracoFile" alt="@node.PageHeading" title="@node.PageHeading" width="126" height="126"/></a> .... as ....
Hmm... sounds like the problem is with the node.akramTreasureThumbImage property. What datatype is that using? Perhaps one of your Treasure.Children doesn't have it set?
When I'm debugging razor scripts I find it handy to output the values directly just to see what they are. So try commenting out the link line and add a couple lines as follows to determine what's going on:
@{ var Treasure = @Model.NodeById(1101); <div class="akram-treasure"> @foreach(var node in @Treasure.Children) { //dynamic link = new DynamicMedia(@node.akramTreasureThumbImage); <div>@node.akramTreasureThumbImage</div> <div>@node.akramTreasureThumbImage.GetType()</div> ...} </div> }
umbraco.MacroEngines.DynamicMedia.DynamicMedia() has invalid arguments error
hello
I have following razor script...
@using umbraco.MacroEngines;
@inherits umbraco.MacroEngines.DynamicNode
@inherits umbraco.MacroEngines.DynamicNodeContext
<script src="/scripts/jquery.easing.1.3.js" type="text/javascript"></script>
<script src="/scripts/akram-treasure.js" type="text/javascript"></script>
@{
var Treasure = @Model.NodeById(1101);
<div class="akram-treasure">
@foreach(var node in @Treasure.Children)
{
dynamic link = new DynamicMedia(@node.akramTreasureThumbImage);
string str = @node.content;
<div class="qitem">
<a href="@node.NiceUrl" target="_blank"><img src="@link.umbracoFile" alt="@node.PageHeading" title="@node.PageHeading" width="126" height="126"/></a>
<span class="caption">
<h4>@node.PageHeading</h4>
<p>str.Substring(0,index+1)</p>
</span>
</div>
}
</div>
}
this gives error on page as follows
Error loading Razor Script AkramTreasure.cshtml
The best overloaded method match for 'umbraco.MacroEngines.DynamicMedia.DynamicMedia(umbraco.MacroEngines.DynamicBackingItem)' has some invalid arguments
What is wrong in this?
Which version of Umbraco are you using?
Instead of using the DynamicMedia constructor, try using the Library.MediaById() or Model.MediaById() shorthand methds:
hello...
I am using umbraco 4.7.1. Now, it is not showing razor error. So ur solution was a bit helpful. But It is not fetching image.
In firebug it shows the line .... <a href="@node.NiceUrl" target="_blank"><img src="@link.umbracoFile" alt="@node.PageHeading" title="@node.PageHeading" width="126" height="126"/></a> .... as ....
<a target="_blank" href="/magic-box/dadashri's-akram-treasure/night-club/">a>
What's the problem?
Solved the problem... I think u missed @ sign in line u mentioned. Now, it works. Thanks anyways.
dynamic link = Model.MediaById(@node.akramTreasureThumbImage);
I dont know again the problem is coming...
used the line said by you again
now it shows.....
Hmm... sounds like the problem is with the node.akramTreasureThumbImage property. What datatype is that using? Perhaps one of your Treasure.Children doesn't have it set?
When I'm debugging razor scripts I find it handy to output the values directly just to see what they are. So try commenting out the link line and add a couple lines as follows to determine what's going on:
thank you. It was like one one the nodes was not assigned image. And so the problem was coming.
Glad I could help.
is working on a reply...