Implement ASP.NET Server Control, that renders tree with design like this: <[login to view URL]>
Functionality must include "populate on demand", "persist nodes states in cookies like this? <[login to view URL]>".
Technologies:? asp.net,.net framework 3.5, javascript, css, html, jQuery.
## Deliverables
Control class must be written in c# and should be like this:
public class TreeView : Control,? ICallbackEventHandler // Control receives callbacks for dynamic populate
{
? ? ? public List<TreeNode> Nodes {get; private set;} // Initial nodes
? ? ? public bool SingleSelect {get;set;} // If true - generate radio button per each checkable node, otherwise generate checkbox
? ? ? public event EventHandler<TreeNodePopulateEventArgs> Populate; // this event fired when user first expanding unpopulated node
}
Publicclass TreeNodePopulateEventArgs : EventArgs
{
Public string ClassName{get;private set;} // Parent node classname
Public string ID{get;private set;} // Parent node ID
Public List<TreeNode> ChildNodes{get;privateset;} // filled by user code
Public TreeNodePopulateEventArgs(stringclassName, string id); // constructor
}
TreeNode object represents a tree node
public classTreeNode
{
Public string Title{get;set;} // Node text
Public string Url{get;set;} // Node URL
Public string ClassName{get;set;} // Node classname. Classname is a problem-domain object classname
Public string ID{get;set;} // Node Object ID. Object ID is a problem-domain object classname.
Public bool HasChildren{get;set;} // Flag "node is populated dynamically and can contain children nodes"
Public List<TreeNode> ChildNodes{get;privateset;} // Child nodes
Public bool IsCheckable{get;set;} // Node can be checked (checkbox must be rendered)
Public string Image{get;set;} // node icon. rendered as <IMG> tag. If Image is not set, <IMG> will not be rendered
}
When user trying to expand dynamically populated node first time (node that has HasChildren==true and? [login to view URL] == 0), client javascript must perform a callback to server, server control must fire Populate event, then return to client? [login to view URL] nodes in JSON format, client must render nodes using javascript (jquery).
Server Control must also generate a hidden field, in which client javascript must store selected nodes in format: classname1,id1,classname2,id2, and so on. There must be a function in Server Control to get selected node classes and ids.