ASP.NET DetailsView add an item in dropdownlist in the InsertTemplate mode
<p>I am new to ASP.NET.<br>
I can not figure out how to add an item in the dropdownlist in the DetailsView.  </p>

<pre><code>&lt;asp:TemplateField HeaderText="VendorName"&gt;
    &lt;ItemTemplate&gt;
        &lt;asp:Label ID="lblVendorName" 
        runat="Server" style="text-align:left; 
        width:100%" 
        Text='&lt;%# Eval("VendorName")%&gt;' Width="70%"/&gt;
    &lt;/ItemTemplate&gt;
    &lt;InsertItemTemplate&gt;
        &lt;asp:DropDownList id="insertVendorName" 
            datasourceid="VendorSqlDataSource"
            datatextfield="VendorName" DataValueField="VendorID"  
            OnSelectedIndexChanged="ddlVendor_SelectedIndexChanged" 
            runat="server" AutoPostBack="true"  /&gt;
        &lt;asp:SqlDataSource ID="VendorSqlDataSource"  
        ConnectionString="&lt;%$Connectionstrings:ConnectionString%&gt;"
            SelectCommand="SELECT VendorID, VendorName 
            from MDF_Vendor"  runat="server"&gt;
        &lt;/asp:SqlDataSource&gt;
    &lt;/InsertItemTemplate&gt;

    &lt;EditItemTemplate&gt;
        &lt;asp:DropDownList id="VendorName" 
        datasourceid="VendorSqlDataSource"  
        AutoPostBack="true"
        datatextfield="VendorName"  
        DataValueField="VendorID"  
        SelectedValue='&lt;%# Bind("VendorID") %&gt;'     
        runat="server" 
        OnSelectedIndexChanged="ddlVendor_SelectedIndexChanged"  /&gt;

        &lt;asp:SqlDataSource ID="VendorSqlDataSource"  
        ConnectionString="&lt;%$Connectionstrings:ConnectionString%&gt;"
            SelectCommand="SELECT VendorID, VendorName 
            from MDF_Vendor"  runat="server"&gt;
        &lt;/asp:SqlDataSource&gt;
    &lt;/EditItemTemplate&gt;
&lt;/asp:TemplateField&gt;
</code></pre>

<p>The set of buttons in template</p>

<pre><code>&lt;asp:TemplateField&gt;  
&lt;ItemTemplate&gt; 
    &lt;asp:LinkButton ID="btnedit" runat="server" 
    CommandName="Edit" Text="Edit"/&gt;  |   
    &lt;asp:LinkButton ID="btnInsert" runat="Server" 
    Text="New" CommandName="New" /&gt;  |  
    &lt;asp:LinkButton ID="btnDelete" runat="server" 
    CommandName="Delete" Text="Delete" /&gt;      | 

&lt;/ItemTemplate&gt;  

&lt;InsertItemTemplate&gt;
    &lt;asp:LinkButton ID="btnInsert" runat="Server" 
    Text="Insert" CommandName="Insert"/&gt;    
    &lt;asp:LinkButton ID="btncancel" runat="server" 
    CommandName="Cancel" Text="Cancel"/&gt; 
&lt;/InsertItemTemplate&gt;

&lt;EditItemTemplate&gt;                                                 
    &lt;asp:LinkButton ID="btnupdate" runat="server" 
    CommandName="Update" Text="Update" /&gt;                  
    &lt;asp:LinkButton ID="btncancel" runat="server" 
    CommandName="Cancel" Text="Cancel"/&gt;       
&lt;/EditItemTemplate&gt;
</code></pre>

<p>Below coce is I am trying to switch from ItemTemplate mode to InsertTemplate mode so I can find the ControlName "insertVendorName", and then insert an item call '-- Select --', but it does nothing. </p>

<pre><code>protected void CustomerDetailView_ItemCommand(object sender, DetailsViewCommandEventArgs e)
{

    // Use the CommandName property to determine which button
    // was clicked. 
    if (e.CommandName == "New")
    {
        DetailsView1.ChangeMode(DetailsViewMode.Insert);
        DetailsView1.DataBind();

        DropDownList ddlVendor = (DropDownList)DetailsView1.FindControl("insertVendorName");
        //ddlVendor.Items.Clear();
        ddlVendor.Items.Insert(0, "1234");
    }
}
</code></pre>

<p>Please help.  Thanks in advance.</p>
