Ext2.0 +. Net 2.0 Application Example (2)--Dynamically loading tree with EXTJS implementation

Source: Internet
Author: User

One development environment
Windows 2003
VS 2005
Aptana
Ext2.0

Two client code
HTML: < HTML >
< head >
< meta HTTP-EQUIV = "Content-type" Content = "text/html"; Charset=iso-8859-1 ">
< title > Reorder Treepanel </title >
< link rel = "stylesheet" type = "text/css" href = "resources/css/ext-all.css"/>

<!--GC-->
<!--LIBS-->
< script type = "Text/javascript" src = "adapter/ext/ext-base.js" ></script >
<!--endlibs-->

< script type = "Text/javascript" src = "ext-all.js" ></script >
< script type = "Text/javascript" src = "reorder.js" ></script >

< BODY >

< div id = "Tree-div" style = "overflow:auto;" height:300px;width:250px;border:1px solid #c3daf9; "></div >

</Body >
</HTML >

JS:Ext.onReady (function () ... {
Shorthand
var tree = Ext.tree;

var tree = new Tree.treepanel (...) {
El: ' Tree-div ',
Usearrows:true,
Autoscroll:true,
Animate:true,
Enabledd:true,
Containerscroll:true,
Loader:new Tree.treeloader (.....) {
Dataurl: ' ajax.aspx '
})
});

Set the root node
var root = new Tree.asynctreenode (...). {
Text: ' Head office ',
Draggable:false,
ID: ' Source '
});
Tree.setrootnode (root);

Render the Tree
Tree.render ();
Root.expand ();
} );
Three service-side code
Create a new ajax.aspx page
Using System;
Using System.Data;
Using System.Web;

public partial class Ajax:System.Web.UI.Page
... ... {
protected void Page_Load (object sender, EventArgs e)
...... {
string result = "[{" CLS ":" Folder "," id ":" The Leaf ": false," children ": [{" CLS ":" File "," id ": One," leaf ": true," children ": NULL, "text": "S600"},{"CLS": "File", "id": "leaf": true, "children": null, "text": "SLK200"}, "text": "Business Unit"}];
Response.Write (Result);
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.