Datatype is an own created type which uses the render control "Embedded Content".
Inside this embedded countent datatype i am using a content picker and a textstring ("tooltip").
So what i want to do is to loop through all of the embedded content entries for footerLinks and show a tooltip if the "tooltip" textfield is filled out.
I think you can't use HasValue because the embedded content doctype returns xml that you need to query. HasValue only works on the property of your doctype not on the properties of your embedded content
HasValue inside foreach loop
Hi,
Everytime i try to use the HasValue inside a foreach loop it does not work (we are using version 4.7.2)
foreach(dynamic item in Model.AncestorOrSelf(1).footerLinks) {
if (item.HasValue("tooltip")) {
do something
}
}
It always show the error:
No overload for method 'HasValue' takes '1' arguments
Is footerLinks a property or a doctype ?
Dave
Its a property of type embedded content
What is the datatype you are using to embed the content
Datatype is an own created type which uses the render control "Embedded Content".
Inside this embedded countent datatype i am using a content picker and a textstring ("tooltip").
So what i want to do is to loop through all of the embedded content entries for footerLinks and show a tooltip if the "tooltip" textfield is filled out.
I was able to achieve it by using
if(!string.IsNullOrEmpty(@item.tooltip.InnerText.ToString())) {
But i want to use the HasValue property instead
Any idea why i cant use HasValue here?
Can you have a look in this post, I think it is what you need :
http://our.umbraco.org/projects/backoffice-extensions/embedded-content/general/29650-Get-the-property-values-using-razor
Hi dawoe,
No sorry,
I just want to use HasValue instead of if(!string.IsNullOrEmpty(@item.tooltip.InnerText.ToString())) {
but i am not able to achieve this
Thanks
I think you can't use HasValue because the embedded content doctype returns xml that you need to query. HasValue only works on the property of your doctype not on the properties of your embedded content
Dave
oh ok :-(
Thanks
is working on a reply...