Hi could anyone please point me into the correct direction of how I can display the checkboxes for only the child nodes in the tree view.I am using exactly the same sample of the hierarchial data as of telerik demos but when I set the checkboxes = true it renders checkboxes in the parent node as well. any suggestions would be greatly appreciated.
thanks
thanks
4 Answers, 1 is accepted
0
-DJ-
Top achievements
Rank 1
answered on 20 Sep 2008, 02:48 PM
Hi Shahab,
This should work:
This should work:
Sub nodeCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeNodeEventArgs) Handles treeview1.NodeCreated
If e.Node.Level = 0 Then
e.Node.Checkable = False
End If
End Sub
Regards,
-DJ-
0
shahab
Top achievements
Rank 1
answered on 21 Sep 2008, 12:08 AM
Thank you so much and it seems to have done the trick, but the checkboxes appear below each node's text for some reason. I would prefer the checkboxe appear adjacent to the text of the node on the left. here is the code below for databing the treeview:
private void LoadWorkoutTreeView() | |
{ | |
WorkoutCollection wo = new WorkoutCollection(); | |
DataTable dt = new DataTable(); | |
dt = wo.CustomLoad(2,Convert.ToDateTime(dpFrom.SelectedDate),Convert.ToDateTime(dpTill.SelectedDate)); | |
tvwUserWorkout.DataTextField = "Title"; | |
tvwUserWorkout.DataFieldID = "CategoryID"; | |
tvwUserWorkout.DataFieldParentID = "ParentId"; | |
tvwUserWorkout.DataSource = dt; | |
tvwUserWorkout.DataBind(); | |
} | |
public void nodeCreated(object sender,Telerik.Web.UI.RadTreeNodeEventArgs e) | |
{ | |
if (e.Node.Level == 0) | |
{ | |
e.Node.Checkable = false; | |
} | |
} |
0
Accepted
-DJ-
Top achievements
Rank 1
answered on 21 Sep 2008, 12:57 PM
Hi Shahab,
I don't think that problem is related to the databinding, it's likely something in the treeview declaration itself or the skin css.
Regards,
-DJ-
I don't think that problem is related to the databinding, it's likely something in the treeview declaration itself or the skin css.
- Did you state a specific width for the treeview, or add some declaration to it's style element?
- Are you using a custom skin, if so go through the skin css and see if you can find the explanation there, if not, what skin are you using?
Regards,
-DJ-
0
shahab
Top achievements
Rank 1
answered on 21 Sep 2008, 11:51 PM
Thank DJ for your time and effort. Yes you were correct the issue was CSS related as I did't realise the div had a fixed width.
Thank you again.
Thank you again.