RADTREEVIEW data binding

zhaozj2021-02-16  57

Using telerik.WebControls;

Private void page_load (object sender, system.eventargs e) {// Place the user code here to initialize the page if (! page.ispostback) bindtree (); //radtreeview1.collapseall ();

Private void bindtree () {fileclass fc = new fileclass (); dt = fc.getfolder (); addtree (0, (radtreenode) null;}

public void AddTree (int ParentID, RadTreeNode pNode) {DataView dvTree = new DataView (dt); dvTree.RowFilter = "parentid =" ParentID; foreach (DataRowView Row in dvTree) {if (pNode == null) {// add Root node Radtreenode node = cretenode (row ["filename"]. Tostring (), false; node.image = "folder.gif"; node.ImageExpanded = "folderopen.gif"; node.value = "//" Row ["FileName"]. TOSTRING (); RADTREEVIEW1.AddNode (Node); addtree (Row ["ID"]. ToString ()), Node);} else {// Add current node child node Radtreenode Node = Createnode (Row ["FileName"]. Tostring (), false; node.image = "folder.gif"; node.ImageExpanded = "folderopen.gif"; node.value = pnode.value "//" Row ["filename"]. TOSTRING (); pnode.addnode (node); addtree (rot32.parse); toString ()), node);}} private radtreenode createnode (String text, Bool Expanded) {RADTREENODE Node = New Radtreenode (Text); Node.expanded = Expanded; Return Node;

转载请注明原文地址:https://www.9cbs.com/read-15540.html

New Post(0)