public class MyContentList
{
public string Text { get; set; }
public List<MyContent> Items { get; set; }
public string ItemType { get; set; }
[DefaultValue("_blank")]
public string Target { get; set; }
public MyContentList()
{
}
}
Please advice how do I load the items in the first code block?
System.Web.IHtmlString' does not contain a definition for 'ToList' and no extension method 'ToList' accepting a first argument of type 'System.Web.IHtmlString' could be found (are you missing a using directive or an assembly reference?)
What does the data look like that you are trying to store, it looks like you are trying to store content of an RTE into a list? I question whether there is a better approach for your fieldtype in the CMS for what you are trying to do.
If you are sure you need to use that field type, try doing .ToString() before the .ToList() but this may not parse the data correctly as the RTE can have a variety of rich text content.
Loading the list in the model
Hi, I need to display a list of items. How do I add this list to the mvc model?
I have
and the model
Please advice how do I load the items in the first code block?
Hi,
Would you not just need:
so this doesn't work
What does the data look like that you are trying to store, it looks like you are trying to store content of an RTE into a list? I question whether there is a better approach for your fieldtype in the CMS for what you are trying to do.
If you are sure you need to use that field type, try doing .ToString() before the .ToList() but this may not parse the data correctly as the RTE can have a variety of rich text content.
The problem is that the list is not even displayed in the Fields.
also
@Umbraco.Field("something").ToList()
does not existI did it with FOR loop manually transferring every item. if someone has better solution please tell
is working on a reply...