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

Right now Kettic DropDownTree can only allow you to bind it to data source which implements IEnumerable, such as Array. Meanwhile, data binding to DataTable is also supported. We might also consider adding support for data binding to ArrayList, Generic List and so on. If you are interested, you might stay tuned or contact our service support.
Using this DropDownTree control for ASP.NET, users can easily create a flat data structure, or a hierarchic one if you prefer, when the proper ID and ParentID relationship is set before hand. Listed below are the simple steps which you can follow to set up your IEnumerable data binding. Please note that the collection you have created is automatically mapped to the Text property for the binding tree node.
  1. Create a collection. This collection will be used as your data source later on.
  2. Add value and set the binding. Input values to the collection, that is, the entries that displays in your DropDownTree node. After that, you can set the Kettic DropDownTree DataSource property to the instance of the collection.
  3. At last, you can call the DataBind() method to successfully bind the DropDownTree to the collection you have previously created in the first step.
In the example below, we will provide a simple demo so you can learn how to bind the data from your custom collection to a target DropDownTree node. In this sample, we will create a node for seasons with four entries: Spring, Summer, Autumn and Winter. Then we will set the DataSource property of the DropDownTree to the instance of this seasons collection. After that, we can call the DataBind() method and you can see a corresponding tree node is created directly.
In this demo, we have used a few properties and methods for DropDownTree data binding. Take a look at the list below and you will get a general idea. To learn more details, please refer to the user manual.
Data Source: This property is used when you want to set to an instance of your data source. It should always be used for DropDownTree data binding at run time.
DataBind(): You can call this method to bind a DropDownTree node to your specified data source, like a collection you have created. It can only be used after you have set it to an instance of your data source.
Aspx sample code:
<kettic:PerDropDownTree ID="PerDropDownTree1" runat="server" 
DefaultMessage="Please select" Width="250px"
TextMode="FullPath" >
<DropDownSettings AutoWidth="Enabled" />
</kettic:PerDropDownTree>
C# sample code:
protected override void OnLoad(EventArgs e)
{

if (!IsPostBack)
{
string[] seasons = new string[] { "Spring", "Summer", "Autumn", "Winner" };

PerDropDownTree1.DataSource = seasons;

PerDropDownTree1.DataBind();
}
}
DropDownTree Data Binding Sample:
ASP.NET AJAX UI Controls