$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
DropDownTree Data Binding with DataTable in ASP.NET
Home > How to > DropDownTree Data Binding to DataTable

Kettic DropDownTree control allows you to bind to various data sources, such as DataTable, Array, to name just a few. If any other data sources become popular choices for data binding, we might also considering adding that support in the future.
In this tutorial, we will provide a sample to show you how to easily bind Kettic DropDownTree to a DataTable in your ASP.NET web application. Before we get started that, first please get to know some of the properties and methods you might encounter later while binding Kettic DropDownTree to DataTable.
DataSource: Developers can use this property to set DropDownTree to an instance of your data source. If you would like to bind DropDownTree at run time, you can only set this property.
DataFieldID: This property specifies the field name from your data source. It is very useful for identifying each unique row from each other. This property cannot be avoided when you are binding a DropDownTree to hierarchical data.
DataFieldParentID: This property is also used specify the field name from your data source. However, it is different form DataFieldID because its function is to identify the row from the parent node. This property is generally used for hierarchical data binding.
DataFieldText: In general, this property is used during data binding process. It is used to specify the field name from the data source in order to populates each of the Node's Text property.
In the example below, we provide sample codes so you can bind your Kettic DropDownTree control to a DataTable with hierarchical data, and display a DropDownTree as specified in your data source.
Aspx codes:
<kettic:PerDropDownTree ID="PerDropDownTree1" runat="server" DefaultMessage="Please select" Width="250px"
DataFieldID="ID" DataFieldParentID="ParentID"
<DropDownSettings AutoWidth="Enabled" />
Visual C# sample codes:
protected override void OnLoad(EventArgs e)
PerDropDownTree1.DataSource = GetData();

if (!IsPostBack)


public DataTable GetData()
DataTable table = new DataTable();

table.Rows.Add(new String[] { "1", null, "customValue1", "Item 1" });
table.Rows.Add(new String[] { "2", "1", "customValue2", "Item 1.0" });
table.Rows.Add(new String[] { "3", "2", "customValue3", "Item 1.0.0" });
table.Rows.Add(new String[] { "4", "3", "customValue4", "Item" });
table.Rows.Add(new String[] { "5", "3", "customValue5", "Item" });
table.Rows.Add(new String[] { "6", "5", "customValue2", "Item" });
table.Rows.Add(new String[] { "7", "6", "customValue2", "Item" });
table.Rows.Add(new String[] { "8", "7", "customValue2", "Item" });
table.Rows.Add(new String[] { "9", "1", "customValue9", "Item 1.1" });
table.Rows.Add(new String[] { "10", "1", "customValue10", "Item 1.2" });

return table;
Here is how the DropDownTree looks like after binding to DataTable: