title: Using jQuery Dynatree with checkboxes in ASP.NET (not MVC)
body: <p>Right now I am using a ASP.NET TreeView with checkboxes enabled in my page, and I dynamically populate the tree in the C# code behind by using node values to store id's obtained from the db. On postback, I iterate through the nodes and get the checked ones and store back in the db.</p>
  
  <p>To get tri-state checkboxes(not possible in the ASP.NET TreeView), I want to move to a jQuery Treeview. The most promising one seems to be Dynatree at <a href="http://wwwendt.de/tech/dynatree/doc/samples.html" rel="nofollow">http://wwwendt.de/tech/dynatree/doc/samples.html</a> (click persistence on the left.)</p>
  
  <p>Is there some other free ASP.NET Treeview with checkboxes that can be used?</p>
  
  <p>To populate the dynatree, I am thinking of writing UL and LI elements to a ASP.NET LiteralControl and then configuring Dynatree in the html to populate the tree with that DIV. Is this the best way? Do I put the node id in the li id as it's suggested in the docs so that I can read it back at the backend? </p>
  
  <p>However, I am not able to find an easy way to read the values back in the codebehind to store in the db..
  i.e how to see if a checkbox node was checked in the C# code?
  The docs say this:
  // Get a JavaScript object copy of the tree
  var dict = $("#tree").dynatree("getTree").toDict();
  // ... then use Ajax to send this to your server...</p>
  
  <p>Can it be seen in the postback button click event somehow without using ajax, use hidden asp.net controls and read it in the postback? </p>
  
  <p>Documentation is here <a href="http://wwwendt.de/tech/dynatree/doc/dynatree-doc.html" rel="nofollow">http://wwwendt.de/tech/dynatree/doc/dynatree-doc.html</a></p>