DropDownList empty after postback
<p>I'm working on ASP.NET 4.0 and I'm having problems for saving the selected value in a DropDownList.</p>

<p>I initialize it in the Web Control's PreRender method as follows:</p>

<pre><code>    if (!Page.IsPostBack)
        LoadCountryList();
</code></pre>

<p>Where LoadCountryList's code is:</p>

<pre><code>private void LoadCountryList()
{
    var vr = new CountryRepository();
    var countryList = vr.GetAllForList();

    DdlCountry.EnableViewState = true;
    DdlCountry.DataValueField = "code";
    DdlCountry.DataTextField = "name";
    DdlCountry.DataSource = countryList;
    DdlCountry.DataBind();
}
</code></pre>

<p>After I submit the form, I've noticed the DropDownList is empty(it's not before postback). If you take a look at my code, I've enabled the ViewState for this control, but I'm not getting any results yet. Does anybody know what's going on?</p>

<p><strong>EDIT:</strong></p>

<p>Here is the simple code of the control in the aspx file:</p>

<pre><code>                &lt;asp:DropDownList Runat="server" ID="DdlCountry"&gt;
                &lt;/asp:DropDownList&gt;
</code></pre>
