1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / List title not set in lamda expression when multiple languages turned on

List title not set in lamda expression when multiple languages turned on

2 posts, 0 answered
  1. Michael
    Michael avatar
    5 posts
    Registered:
    09 Oct 2009
    06 May 2011
    Link to this post
    I am pulling list items through code in a custom control.  Before I added a new language I was able to access the items I needed through the following code:

    var items = lm.GetListItems()
                .Where(li => li.Parent.Title == "Home Page Slides");

    When I added the new language, this call didn't return any items.  After a little bit of testing I discovered that the Parent's title isn't set yet for some reason.  Using the following code gave me every list item:

    var items = lm.GetListItems()
                .Where(li => String.IsNullOrEmpty(li.Parent.Title));

    Though even when looping through the list right after the call, I was able to output the title as expected:

    foreach (Telerik.Sitefinity.Lists.Model.ListItem li in items) {
                Response.Write("ITEM TITLE: " + li.Title + " PARENT TITLE: " + li.Parent.Title + "<BR>");
            }


    Obviously the work around would be to just loop through the item list after the fact and filter them based on the parent's title, but this is very odd bug and I imagine it will affect other places in my site where I am using similar methods.
  2. Tihomir
    Tihomir avatar
    23 posts
    Registered:
    09 Dec 2016
    11 May 2011
    Link to this post
    Hello Michael,

    Thank you for contacting us!

    This is known issue and it is fixed. It will be released within the upcoming Service Pack(e.g. SP1), which will be available till begin of the next week.

    There is also workaround in case you are not planning to update your installation to SP1. Lets assumed that there are two applied languages in given Sitefinity's installation: English([en]   -> which is default for the system) and French([fr]). In such case you should write your filter expression like this:
    lm.GetItems(typeof(Telerik.Sitefinity.Lists.Model.ListItem), "Title.Contains(\"Home Page Slides\") OR (Title[\"en\"] = null AND Title[\"fr\"] = null AND Title[\"\"].Contains(\"Home Page Slides\"))", string.Empty, 0, 100);

    *Please note you should check if Title is null for every other language,which was added within the Sitefinity's installation(e.g OR.Title[\"it\"] = null in case there is Italian language)

    Kind regards,
    Tihomir
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered