DropDownList populate method affects postback behaviour?
<p>I've started to rewrite code in an existing project and changed the way how two <code>dropdownlists</code> are populated. When using <code>DataBind</code> the <code>SelectedValue</code>has the correct value in the <code>Page_Load</code> after a postback. But when using <code>AddRange</code> the <code>SelectedValue</code> is always the first value in the dropdownlist.</p>

<p>How can the way how the dropdownlists are filled affect the postback behaviour? Yes, there are java scripts in the page also, but I can't see how they could interfere with this.</p>

<p>The way that works (<code>SelectedValue</code> is correct in <code>Page_Load</code>):
</p>

<pre><code>protected void Page_Init(object sender, EventArgs e)
{
    IList&lt;ListItem&gt; list = new List&lt;ListItem&gt;();
    list.Add(new ListItem(Resources.Site.OriginalStructure, "0"));
    list.Add(new ListItem("5", "5"));
    list.Add(new ListItem("10", "10"));
    list.Add(new ListItem("15", "15"));
    list.Add(new ListItem("20", "20"));
    list.Add(new ListItem("25", "25"));

    DropDownList1.DataSource = list;
    DropDownList1.DataTextField = "Text";
    DropDownList1.DataValueField = "Value";
    DropDownList1.DataBind();

    DropDownList2.DataSource = list;
    DropDownList2.DataTextField = "Text";
    DropDownList2.DataValueField = "Value";
    DropDownList2.DataBind();   
}
</code></pre>

<p>The way that doesn't work (<code>SelectedValue</code> is always the first value in ddl in <code>Page_Load</code>):


<pre><code>protected void Page_Init(object sender, EventArgs e)
{
    var numberQuestionsPerPageDdlValues = new[]
    {
        new ListItem(Resources.Site.OriginalStructure, "0"),
        new ListItem("5", "5"),
        new ListItem("10", "10"),
        new ListItem("15", "15"),
        new ListItem("20", "20"),
        new ListItem("25", "25")
    };
    DropDownList1.Items.AddRange(numberQuestionsPerPageDdlValues);
    DropDownList2.Items.AddRange(numberQuestionsPerPageDdlValues);
}
</code></pre>
