Display DB values in a Dropdown list
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/12088358/display-db-values-in-a-dropdownlist">Display DB values in a dropdownlist</a>  </p>
</blockquote>



<p>I am fetching DB values and displaying them in the Dropdown list. I have country and state drop down lists:</p>

<pre><code>DropDownList1.Items.Add(new ListItem(Session["country"].ToString()));
DropDownList2.Items.Add(new ListItem(Session["state"].ToString()));
</code></pre>

<p>I am unable to show the DB values in the DDL. I am getting --select a state--
in the state Dropdown list how to show the DB values in the Dropdown list?</p>

<pre><code>&lt;asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True"&gt;
    &lt;asp:ListItem Value="Select a state" &gt;Select a state&lt;/asp:ListItem&gt;
    &lt;asp:ListItem Value="value 1" &gt;Maharastra&lt;/asp:ListItem&gt;
    &lt;asp:ListItem Value="value 2" &gt;Goa&lt;/asp:ListItem&gt;
    &lt;asp:ListItem Value="value 3" &gt;Kashmir&lt;/asp:ListItem&gt;
&lt;/asp:DropDownList&gt;
</code></pre>

<p>i am cacthing the DB values here and sending them to the next page</p>

<pre><code>  if (dt.Rows.Count &gt; 0)
            {
                DataTable dt1 = new DataTable();
                dt1 = bll.getnewid(TextBox1.Text);

                    if (dt1.Rows.Count &gt; 0)
                    {

                        Session["country"] = dt1.Rows[0]["Country"].ToString();
                        Session["state"] = dt1.Rows[0]["State"].ToString();
</code></pre>
