URGENT! Split multi media picker, display first image - partial view macro
Hey all,
I have a partial view macro file which is my search feature which works really well displaying the found node details, i want it to also display the first image from the multimedia picker for that node and having trouble getting it working!
Here is the snippet of code that pulls/displays the node data, the multimedia field alias is 'images' could someone help!
<table cellpadding="10" cellspacing="5" style="width:98%;">
<tr>
<th>
Deal Name
</th>
<th>
Price
</th>
<th>
Holiday Dates
</th>
<th>
Detail
</th>
<th></th>
</tr>
@foreach (Node c in listDeals)
{
var link = Umbraco.Url(c.Id);
var sDate = c.GetProperty("startDate").Value;
var beginDate = umbraco.library.FormatDateTime(sDate, "d - ");
var eDate = c.GetProperty("endDate").Value;
var endingDate = umbraco.library.FormatDateTime(eDate, "d MMMM yyyy");
<tr>
<td>
@c.GetProperty("name").Value
</td>
<td>@c.GetProperty("price").Value</td>
<td>@{@beginDate @endingDate}</td>
<td>
@Html.Raw(c.GetProperty("mainText").Value)
</td>
<td><a class="pSubmit" href="@{@link}">
View Deal</a><td>
</tr>
}
</table>
Ok, you really don't want/need to be using the old NodeFactory, I've had a quick go at updating your code to use the current methods and added what I think your after with the image:
URGENT! Split multi media picker, display first image - partial view macro
Hey all,
I have a partial view macro file which is my search feature which works really well displaying the found node details, i want it to also display the first image from the multimedia picker for that node and having trouble getting it working!
Here is the snippet of code that pulls/displays the node data, the multimedia field alias is 'images' could someone help!
Hi Peter,
How are you creating/setting the listDeals variable?
Jeavon
Here's the full code buddy if that helps
Ok, you really don't want/need to be using the old NodeFactory, I've had a quick go at updating your code to use the current methods and added what I think your after with the image:
Hey thanks for that! seems to be having trouble though just getting error loading partial view script.
Seems to be with this line
If i remove it loads fine again just obviously without the image!
cheers
Strange, try this instead:
Still wouldn't load oddly?
Have managed to do it using my previous version but i cant figure out how to just use the first image found in the split, any advice on that?
heres the snippet:
Did it show an error?
You should almost never use a management service in a front end view such as MediaService!!
is working on a reply...