pragmatically add items to dropdownlist in detailsview update mode and bind the data
<p>i have a detailview with a dropdownlist</p>

<pre><code>&lt;asp:TemplateField HeaderText="nid" SortExpression="nid"&gt;
                &lt;EditItemTemplate&gt;
                    &lt;asp:DropDownList ID="DropDownList1" runat="server" onclick="btnUpdate_Click"&gt;
                    &lt;/asp:DropDownList&gt;
                &lt;/EditItemTemplate&gt;
                &lt;InsertItemTemplate&gt;
                    &lt;asp:TextBox ID="TextBox1" runat="server" Text='&lt;%# Bind("nid") %&gt;'&gt;&lt;/asp:TextBox&gt;
                &lt;/InsertItemTemplate&gt;
                &lt;ItemTemplate&gt;
                    &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Bind("nid") %&gt;'&gt;&lt;/asp:Label&gt;
                &lt;/ItemTemplate&gt;
            &lt;/asp:TemplateField&gt;
</code></pre>

<p>i want to add the items when using click the update button than bind the data to the dropdownlist </p>

<p>here is the functions</p>

<pre><code>protected void btnUpdate_Click(object sender, EventArgs e)
{
    Response.Write("abc");
    Node node = new Node();

    node.buildTree("all", "arraylist");
    al.Add(null);
    al = node.getArrayList();

    node.flushContent();
    DropDownList DropDownList1 = (DropDownList)DetailsView1.FindControl("DropDownList1");
    //DetailsView1.DropDownList1.Items.Clear();

    DropDownList1.Items.Add(new ListItem("ROOT", ""));
    foreach (pair item in al)
    {
        DropDownList1.Items.Add(new ListItem(item.getTitle(), item.getId()));
    }
}
</code></pre>

<p>i don't know whether my direction is right, but above code is not work~ anyone can help?</p>

<p>thanks</p>
