I have an Archetype property editor set up with multiple fieldsets, each fieldset with 2 fields: a text box, and a media picker for image.
In a GetImage(string imgId){} method I'm trying to get the fieldset with the image url and textBox value based on the imgId parameter from the media picker, and to return a htmlString. Not sure if this the best ideea, I'm open to suggestions.
public static string GetIcon(string iconId)
{
var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
var myProperty = (IPublishedContent)umbracoHelper.Content(5369).GetPropertyValue<ArchetypeModel>("myProperty");
return "";
}
To get all the items from property I would do:
foreach (var item in myProperty)
{
var icon = Umbraco.TypedMedia(item.GetValue("img"));
<img src="@icon.Url" />
<span>@item.GetValue("imgTitle")</span>
}
I noticed while debugging that fieldsets within archetype property don't have built in unique ID's ???
How can I get the image and textBox value by comparing the image Id from media picker?
Something like: ??
var icon = myProperty.Where(x => x.icon == iconId); //wrong
Property Querying (archetype)
Hi,
I have an Archetype property editor set up with multiple fieldsets, each fieldset with 2 fields: a text box, and a media picker for image.
In a
GetImage(string imgId){}
method I'm trying to get the fieldset with the image url and textBox value based on theimgId
parameter from the media picker, and to return a htmlString. Not sure if this the best ideea, I'm open to suggestions.To get all the items from property I would do:
I noticed while debugging that fieldsets within archetype property don't have built in unique ID's ???
How can I get the image and textBox value by comparing the image Id from media picker?
Something like: ??
Thanks,
Dan
is working on a reply...