America/US Samples
Europe Samples
Asia Samples

Gaia Ajax: TreeView - GetChildrenControls Event

It's easy to add new TreeViewItems dynamically to the TreeView by using the GetChildrenControls event. This event is fired if the TreeViewItem subscribes to it and allows you to dynamically populate a TreeView "on-the-fly" and only construct the nodes needed. Dynamic controls must be re-created on each callback, but this is taken care of automatically by this event handler.

In this example the same event handler renders three more childnodes and each reuse the same event handler resulting in a never ending container of children. Go ahead and test how much your browser can take!


Markup (ASPX/.aspx)

   1:   
   2:      <gaia:TreeView AnimateToggling="false" runat="server" ID="tree" Style="width: 100%; height: 100%;overflow: auto;">
   3:          <gaia:TreeViewItem 
   4:              runat="server" 
   5:              IsLeaf="false"
   6:              Collapsed="true" 
   7:              OnGetChildrenControls="TreeView_GetChildrenControls"
   8:              ID="root" 
   9:              IconCssClass="folder">
  10:              Root
  11:          </gaia:TreeViewItem>
  12:      </gaia:TreeView>
  13: