CheckChildNodes with NodeTemplate checkbox

3 posts, 0 answers
  1. David
    David avatar
    48 posts
    Member since:
    Nov 2012

    Posted 28 Sep 2013 Link to this post

    I'm trying to get Knockout to work the treeview so I needed to get the "data-bind" attribute added to the checkbox that is generated.

    I couldn't get it to work in the NodeDataBound when using e.Node.Attributes.Add("data-bind", "myBinding: myObservableArray")...This wasn't being added to the actual HTML which Knockout needs.

    So I tried using the NodeTemplate to be able to customize the HTML checkboxes.  Anyway, Child elements are checked when it's parent is using NodeTemplates with "CheckChildNodes = true"



     <input type="checkbox" value="<%# DataBinder.Eval(Container, "Id") %>" data-bind="myBinding: myObservableArray" />







  2. David
    David avatar
    48 posts
    Member since:
    Nov 2012

    Posted 30 Sep 2013 Link to this post

    If there is a way to access and modify the underlying HTML (which would be the input element in this case) I could probably get this to work  with messing with the NodeTemplate but e.Nodes.Attributes.Add doesn't work that way. 
  3. DevCraft R3 2016 release webinar banner
  4. Boyan Dimitrov
    Boyan Dimitrov avatar
    1728 posts

    Posted 02 Oct 2013 Link to this post


    Thank you for contacting Telerik Support.

    I would like to clarify that node's attributes collection is applied to the node object not to the check box element. Here you may find a list with the valid HTML attributes that are rendered as HTML attributes. Any other custom attributes will not be rendered as HTML attributes. I would like to clarify that even the valid HTML attributes will be applied to the node element not to the check box element.

    In this case the only solution will be to use templates and set the "data-bind" attribute to the check box element within the template.

    Hope that this will be helpful.

    Boyan Dimitrov
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top