This question is locked. New answers and comments are not allowed.
My treeview has two level and three level , but i only want to show the checkbox in the last level , anyone can help me?
<% IQueryable<TreeViewItem> checkedNodes = ListHelper.GetProductCategories(Model.Product.ProductID); %>
<%Html.Telerik().TreeView()
.Name("TreeView")
.ShowCheckBox(true)
.BindTo(productRepository.GetCategories(null),mappings =>
{
mappings.For<ProductCategoryList>(binding => binding
.ItemDataBound((item, category) =>
{
item.Text = category.CategoryName;
item.Value = category.CategoryID.ToString();
if (checkedNodes != null)
{
item.Checked = checkedNodes
.Where(e => e.Value.Equals(category.CategoryID.ToString()))
.FirstOrDefault() != null;
}
})
.Children(category => category.Children));
mappings.For<ProductCategoryList>(binding => binding
.ItemDataBound((item, children) =>
{
item.Text = children.CategoryName;
item.Value = children.CategoryID.ToString();
if (checkedNodes != null)
{
item.Checked = checkedNodes
.Where(e => e.Value.Equals(children.CategoryID.ToString()))
.FirstOrDefault() != null;
item.Expanded = true;
}
}));
})
.Render();
%>
these are my code of treeview , waiting for answer online , it will be helpfull if has any example. Thanks
<% IQueryable<TreeViewItem> checkedNodes = ListHelper.GetProductCategories(Model.Product.ProductID); %>
<%Html.Telerik().TreeView()
.Name("TreeView")
.ShowCheckBox(true)
.BindTo(productRepository.GetCategories(null),mappings =>
{
mappings.For<ProductCategoryList>(binding => binding
.ItemDataBound((item, category) =>
{
item.Text = category.CategoryName;
item.Value = category.CategoryID.ToString();
if (checkedNodes != null)
{
item.Checked = checkedNodes
.Where(e => e.Value.Equals(category.CategoryID.ToString()))
.FirstOrDefault() != null;
}
})
.Children(category => category.Children));
mappings.For<ProductCategoryList>(binding => binding
.ItemDataBound((item, children) =>
{
item.Text = children.CategoryName;
item.Value = children.CategoryID.ToString();
if (checkedNodes != null)
{
item.Checked = checkedNodes
.Where(e => e.Value.Equals(children.CategoryID.ToString()))
.FirstOrDefault() != null;
item.Expanded = true;
}
}));
})
.Render();
%>
these are my code of treeview , waiting for answer online , it will be helpfull if has any example. Thanks