Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi - I have a select statement:
@Model.AncestorOrSelf().Descendants("Staff").Where("Office.Split(',').Contains(\"London\")")
Which is giving me the error: No applicable method 'Split' exists in type 'String'
Which is very weird because the string.Contains method does seem to exist, so:
.Where("Office.Contains(\"" + @Model.Name + "\")")
Works fine - but isn't quite what I'm after!
Hi Ian
Just came across something similar, think it's your @Model, changed to @CurrentPage and problem solved.
Guess it will depend on which version, but should give you a direction.
Regards G
Thanks for the reply gary, but not sure how to use CurrentPage!
@Model.CurrentPage.AncestorOrSelf().Descendants("Staff").Where("Office.Split(',').Contains(\"London\")")
Gives me an error: Cannot implicitly convert type 'umbraco.MacroEngines.DynamicNull' to 'umbraco.MacroEngines.DynamicNodeList' But I'm guessing that's not what you were suggesting?
This is on umbraco v 4.11.1 (Assembly version: 1.0.4715.27659) BTW.
Apologies, didn't mean to confuse.
I use Umbraco in Mvc as opposed to webforms (the calls are slightly different).
But you should be able to use @CurrentPage.AncestorOrSelf() etc.
If you get any more errors, post the version ie Mvc Razor or Webforms razor and I'm sure you will have an answer.
Ah, OK.
The error is in a Razor macro script (cshtml file), as I say I'm running umbraco v 4.11.1 (Assembly version: 1.0.4715.27659).
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Razor/Linq Can't use string.Split?
Hi - I have a select statement:
Which is giving me the error: No applicable method 'Split' exists in type 'String'
Which is very weird because the string.Contains method does seem to exist, so:
Works fine - but isn't quite what I'm after!
Hi Ian
Just came across something similar, think it's your @Model, changed to @CurrentPage and problem solved.
Guess it will depend on which version, but should give you a direction.
Regards G
Thanks for the reply gary, but not sure how to use CurrentPage!
Gives me an error: Cannot implicitly convert type 'umbraco.MacroEngines.DynamicNull' to 'umbraco.MacroEngines.DynamicNodeList' But I'm guessing that's not what you were suggesting?
This is on umbraco v 4.11.1 (Assembly version: 1.0.4715.27659) BTW.
Hi Ian
Apologies, didn't mean to confuse.
I use Umbraco in Mvc as opposed to webforms (the calls are slightly different).
But you should be able to use @CurrentPage.AncestorOrSelf() etc.
If you get any more errors, post the version ie Mvc Razor or Webforms razor and I'm sure you will have an answer.
Regards G
Ah, OK.
The error is in a Razor macro script (cshtml file), as I say I'm running umbraco v 4.11.1 (Assembly version: 1.0.4715.27659).
is working on a reply...