I am trying to pass the crop which is saved i array to the image but its not working for some reason , any one knows where i am getting it wrong, below is the syntax:
<div class="cover">
@{
string[] cropBox = {"crop1","crop2" };
foreach (var node in Model.Children)
{
dynamic croping = @node.mainImage.mediaItem.Image.crop;
<p>@index</p>
@croping;
var t = cropBox[index];
foreach (dynamic crops in croping)
{
<img src="@crops.Find("@name","cropBox[index]").url" alt="" />
}
index++;
}</div>
Think as you have enclosed in a ".." you'll actually be passing cropBox[index] as plain text into the Find method.. (also you posted code references undeclared variables, indes and name...
@{ string[] cropBox = {"crop1","crop2" }; int index = 0; string name = ""; foreach (var node in Model.Children) { dynamic croping = @node.mainImage.mediaItem.Image.crop; <p>@index</p> @croping; var t = cropBox[index]; foreach (dynamic crops in croping) { <img src="@crops.Find(name,cropBox[index]).url" alt="" /> } index++; }
Using forloop to pass types of crop to img
Hi ,
I am trying to pass the crop which is saved i array to the image but its not working for some reason , any one knows where i am getting it wrong, below is the syntax:
Think as you have enclosed in a ".." you'll actually be passing cropBox[index] as plain text into the Find method.. (also you posted code references undeclared variables, indes and name...
@{ string[] cropBox = {"crop1","crop2" }; int index = 0; string name = ""; foreach (var node in Model.Children) { dynamic croping = @node.mainImage.mediaItem.Image.crop; <p>@index</p> @croping; var t = cropBox[index]; foreach (dynamic crops in croping) { <img src="@crops.Find(name,cropBox[index]).url" alt="" /> } index++; }
is working on a reply...