I have got Category, CategoryProducts, and Products table in my DB
CategoryProducts has foreign key{CategoryID} to Category table and {ProductID} foreign key to Products table.
I used Entity Framework for my data access needs and to load use following syntax.
IList<Categories> categoriesToDisplay = Context.Categories.Include("CategoryProducts").Where(x=>x.CategoryID= + categoryID +)
model.Categories = categoriesToDisplay;
Please note that categoriesToDisplay has collection of CategoryProducts which is of type EntityCollection, EntityCollection class
implements IEnumerable so binding should not be a problem using Telerik
and i am trying to use categoriesToDisplay collection using Telerik Menu control but dealing with an issue i could not resolve.
here is the code for Telerik.
<%=Html.Telerik().Menu()
.Name("nav")
.BindTo(Model, mappings =>
{
mappings.For<Categories>(binding => binding
.ItemDataBound((item, category) =>
{
item.Text = category.Name;
})
.Children(category => category.CategoryProducts ));
mappings.For<CategoryProducts>(binding => binding
.ItemDataBound((item, catProduct) =>
{
item.Text = catProduct.Product.ProductName;
}));
})
%>
This is the error i get.
MainLayout.master: The best overloaded method match for
'Telerik.Web.Mvc.UI.MenuBuilder.BindTo(string, System.Action<Telerik.Web.Mvc.UI.MenuItem,Telerik.Web.Mvc.SiteMapNode>)'
has some invalid arguments
Can anyone shed any light on this
Thanks - Bari