Private void inittree2 (treenodecollection NDS, string parentid, int flag) { Dataview DV = new dataview (); Treenode tmpnd; DV. Table = dstree. Tables [0]; DV. rowfilter = "parentid = '" + parentid + "'"; Foreach (datarowview DRV in DV) { Tmpnd = new treenode (); Tmpnd. ID = DRV ["ID"]. tostring (); Tmpnd. TEXT = "<input type = 'checkbox' id = 'chkplan' value = '" + DRV ["ID"]. tostring () + "'onclick = 'searcharea (this); '>" + DRV ["dname"]. tostring (); Tmpnd. navigateurl = "destlocaledit. aspx? Id = "+ DRV [" ID "]. tostring () +" & parentid = "+ DRV [" parentid "]. tostring (); NDS. Add (tmpnd ); Inittree2 (tmpnd. nodes, tmpnd. ID, flag ); } } If you want to know which nodes are selected, you can change your mind, First, a <input id = "text1" type = "hidden" name = "text1" runat = "server" value = ","> Then rewrite searcharea: Function searcharea (objtreecheckbox) { VaR curid = objtreecheckbox. value; VaR selected = Document. getelementbyid ("text1"). value; If (objtreecheckbox. Checked) Selected + = curid + ","; Else Selected = selected. Replace ("," + curid + ",",","); Document. getelementbyid ("text1"). value = selected; } So, whether in Javascript or in the background C #CodeYou can obtain the value of the currently selected node at any time. |