'Link' is an ambiguous reference between 'Umbraco.Web.Models.Link' and 'Umbraco.Web.PublishedModels.Link'
Hi there Umbraco people,
I am trying to get the links from my multi link picker but I am getting this error.
Does anyone know what is this about, as I have used the link picker before with no issues.
I also have to mention that I tried to use Model.Ancestors() with no luck today.
It said that the Model does not contain a definition for Ancestors, so I gave up on that. But I would really like to get this multi link to work.
This is because both namespaces, Umbraco.Web.Models and Umbraco.Web.PublishedModels contains a definition of 'Link'. You can easily solve this by changing this line of code:
var files = doc.Value<IEnumerable<Link>>("documentFiles");
to:
var files = doc.Value<IEnumerable<Umbraco.Web.PublishedModels.Link>>("documentFiles");
'Link' is an ambiguous reference between 'Umbraco.Web.Models.Link' and 'Umbraco.Web.PublishedModels.Link'
Hi there Umbraco people,
I am trying to get the links from my multi link picker but I am getting this error.
Does anyone know what is this about, as I have used the link picker before with no issues.
I also have to mention that I tried to use Model.Ancestors() with no luck today. It said that the Model does not contain a definition for Ancestors, so I gave up on that. But I would really like to get this multi link to work.
Thank you.
Hi Raluca,
This is because both namespaces, Umbraco.Web.Models and Umbraco.Web.PublishedModels contains a definition of 'Link'. You can easily solve this by changing this line of code:
to:
Thank you.
Using the first one worked for me.
Along the same lines as Erik's response, except as it's in a view it might error saying it can't find web.
If you add the following using statement at the top of the view
Then you can do
I think :-)
Nik
It does not complain so I am going to accept Erik's answer as the solution.
But yours it's a perfectly valid answer as well, if you include the IEnumerable in the query. Thank you
is working on a reply...