This is a migrated thread and some comments may be shown as answers.

[Solved] Remove checkbox from all parent nodes in treeview

0 Answers 92 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
shilpa
Top achievements
Rank 1
shilpa asked on 31 Jan 2011, 07:22 AM
Hi,

How can I remove checkbox from all parent nodes in treeview. I am binding it in following way, but this removes checkbox only from first level of parents.

<%

= Html.Telerik().TreeView()
.Name(
"TreeView1")
.ShowLines(
true)
.ShowCheckBox(
true)
.ClientEvents(events => events
.OnChecked(
"onChecked")
.OnLoad(
"onLoad")
)
.BindTo(
SiteMap.Provider.RootNode.ChildNodes, mappings =>
{
mappings.For<
SiteMapNode>(binding => binding
.ItemDataBound((item, navitem) =>
{
item.Text = navitem.Title;
item.Value = navitem.Description;
if (item.Parent == null)
{
item.Checkable =
false;
}
if(ViewData["Fn_Id"] != null && item.Value.Contains(ViewData["Fn_Id"].ToString()))
{
item.Checked =
true;
item = item.Parent;
while(item!=null)
{
item.Expanded =
true;
item = item.Parent;
}
}
})
.Children(navitem => navitem.ChildNodes)
.Children(childitem => childitem.ChildNodes));
})
%>

 

Tags
TreeView
Asked by
shilpa
Top achievements
Rank 1
Share this question
or