Hello all, I am trying to use the uComponents DataType UrlPicker which stores a URL, open in new window and the title. Which works fantasitcally well with Razor. The problem I am currently having is when I want to get a recursive value of this. However the datatype is still storing values even if the urlPicker data type is empty.
//URL picker data type (Fetch it recursively)var brandLinkNew = Model._brandLinkNew;
if (brandLinkNew != null)
{
brandLinkNew.Title;
}
I don't think there is really a good solution for this. I think the url picker always stores a value so it will never recursively go to the parent. It might be best to check if an url is available and if it's not go to the parent and fetch the property from there.
OK not quite the code I needed but this should do it now
//URL picker data typevar brandLink = Model.BrandLink;
var current = Model;
while (string.IsNullOrWhiteSpace(brandLink.Url) && Model.Parent.Id != -1)
{
brandLink = current.brandLink;
current = current.Parent;
}
URL Picker uComponents DataType - Recusive Value
Hello all,
I am trying to use the uComponents DataType UrlPicker which stores a URL, open in new window and the title.
Which works fantasitcally well with Razor.
The problem I am currently having is when I want to get a recursive value of this. However the datatype is still storing values even if the urlPicker data type is empty.
I don't think there is really a good solution for this. I think the url picker always stores a value so it will never recursively go to the parent. It might be best to check if an url is available and if it's not go to the parent and fetch the property from there.
Jeroen
Jeroen, how would I go about doing the alternative way you have suggested?
Cheers,
Warren :)
Ok figured it out in the end with a while loop
OK not quite the code I needed but this should do it now
Try using LINQ
Hope it will help you!
is working on a reply...