Dropdownlist databound to sqldatasource - inserted record doesn't show until page refreshed
<p>I have a dropdownlist of suppliers which is bound to an sqldatasource.  A supplier can be added via a formview but once the insert button is clicked the record is inserted into the database but doesn't show on the dropdownlist.</p>

<p>The code for the sqldatasource is as follows:</p>

<pre><code>&lt;asp:SqlDataSource runat="server" ID="sqlAddSupplier" 
 ConnectionString="&lt;%$ ConnectionStrings:cctConnectionString%&gt;" 
 ProviderName="&lt;%$ ConnectionStrings:cctConnectionString.ProviderName%&gt;" 
 InsertCommand="suppliers_Insert" InsertCommandType="StoredProcedure"&gt;
    &lt;InsertParameters&gt;
        &lt;asp:SessionParameter SessionField="siteId" DefaultValue="0" Name="p_siteId" Type="Int64" /&gt;
        &lt;asp:Parameter Name="code" Type="String" /&gt;
        &lt;asp:Parameter Name="name" Type="String" /&gt;
    &lt;/InsertParameters&gt;
&lt;/asp:SqlDataSource&gt;
</code></pre>

<p>The code for the dropdownlist and formview to add a supplier is as follows:</p>

<pre><code>&lt;asp:DropDownList ID="lstSuppliers" runat="server" CssClass="dropDownList" 
 AppendDataBoundItems="true" DataSourceID="sqlSuppliers" DataTextField="name" 
 DataValueField="id" SelectedValue='&lt;%# Bind("supplierId") %&gt;' &gt;
    &lt;asp:ListItem Text="" Value="0"&gt;&lt;/asp:ListItem&gt;
&lt;/asp:DropDownList&gt;

&lt;asp:Panel runat="server" ID="pnlAddSupplier" CssClass="groupBoxPageWidth"&gt;

    &lt;asp:FormView ID="fvAddSupplier" runat="server" DataSourceID="sqlAddSupplier" 
     OnItemInserted="fvAddSupplier_ItemInserted"&gt;

        &lt;InsertItemTemplate&gt;
            &lt;b&gt;Code:*&lt;/b&gt;
            &lt;asp:TextBox ID="txtCode" runat="server" Text='&lt;%# Bind("code") %&gt;' CssClass="textbox"&gt;&lt;/asp:TextBox&gt;
            &lt;b&gt;Name *:&lt;/b&gt;
            &lt;asp:TextBox ID="txtName" runat="server" Text='&lt;%# Bind("name") %&gt;' CssClass="textbox"&gt;&lt;/asp:TextBox&gt;
            &lt;br /&gt;&lt;br /&gt;
            &lt;asp:Button runat="server" ID="cmdInsertSupplier" Text="Save" CssClass="buttonControlGreen" CommandName="Insert" OnClientClick="needToConfirm=false;" /&gt;
            &lt;asp:Button runat="server" ID="cmdCancelSupplier" Text="Cancel" CssClass="buttonControl" CommandName="Cancel" OnClientClick="needToConfirm=false;" /&gt;
        &lt;/InsertItemTemplate&gt;
    &lt;/asp:FormView&gt;
&lt;/asp:Panel&gt;
</code></pre>

<p>The code behind for the ItemInserted event is as follows:</p>

<pre><code>protected void fvAddSupplier_ItemInserted(object sender, FormViewInsertedEventArgs e)
{
    fvAddSupplier_CommandCompletion(e.Exception, e.KeepInInsertMode, "Inserted");
}

protected void fvAddSupplier_CommandCompletion(Exception sqlException, bool keepInMode, String procedureExecuted)
{
    Panel pnlAddSupplier = (Panel)fvProduct.FindControl("pnlAddSupplier");
    Label lblAddSupplierError = (Label)pnlAddSupplier.FindControl("lblAddSupplierError");

    if (sqlException != null)
    {
        keepInMode = true;
    }
}
</code></pre>

<p>It will refresh the dropdownlist if I call Response.Redirect to refresh the whole page but I assume this should happen at PostBack anyway?  I have also tried calling DataBind on the dropdownlist once the record has been inserted but then see the following error:</p>

<pre><code>Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
</code></pre>

<p>I am relatively new to asp.net so may be missing something obvious, any help would be appreciated.</p>
