Databinding Accordion to List<string> problem

Last post 03-08-2009 9:49 AM by yasserzaid. 1 replies.

Sort Posts:

  • Databinding Accordion to List<string> problem

    02-28-2009, 1:42 AM

    Pl disregard, sorry.

    Justin 

     

    Hey, just a quick q on the embedded Databinding syntax for the Accordion (i.e.  <Content><%# DataBinder.Eval(Container.DataItem, "mysteryString")%></Content> )

    What is the second arg for Eval if my server code is:

            categoriesAccordion.DataSource = ProductsEntity.SecondaryCategories("Bread");
            categoriesAccordion.DataBind();
    ...and in ProductsEntity ...

        private static readonly Func<Quickshop35sp1, string, List<string>>
                                SecondaryCategoriesCompiledLinq = CompiledQuery.Compile
                                ((Quickshop35sp1 qs35sp1, string primaryCategory) =>
                                (from prod in qs35sp1.ProductsSet
                                 where prod.CategoryPrimary == primaryCategory
                                 group prod by prod.CategorySecondary into grp
                                 select grp.Key).ToList());

        public static List<string> SecondaryCategories(string categoryPrimary)
        {
            Quickshop35sp1 qs35sp1 = new Quickshop35sp1();
            List<string> secondaries = SecondaryCategoriesCompiledLinq.Invoke(qs35sp1, categoryPrimary);

            return secondaries;
        }

    The error I'm getting is 'LINQ to Entities does not recognize the method 'System.Collections.Generic.List`1[System.String] ToList[String](System.Collections.Generic.IEnumerable`1[System.String])' method, and this method cannot be translated into a store expression.'. There's nothing wrong with the LINQ query, it's the last bit 'cannot be translated', and I think if the 2nd arg for DataBinder.Eval was right, it'd be fine.

    Appreciate any help,

    Justin.

  • Re: Databinding Accordion to List<string> problem

    03-08-2009, 9:49 AM
    • All-Star
      15,283 point All-Star
    • yasserzaid
    • Member since 09-22-2007, 9:10 PM
    • Egypt
    • Posts 2,586
Page 1 of 1 (2 items)