title: Add items and value of the drop down list from the database
body: <p>I used this c# code to add items in <code>dropdownlist(ddlSub)</code> from the table <code>sub_info</code>. But what I want is to add the value of the items in <code>dropdownlist(ddlSub)</code> from the same table which also has a column named <code>sub_id</code> of datatype <code>varchar(50)</code>.</p>
  
  <pre><code>private void bind_ddlSub()
  {
  
      ddlSub.Items.Insert(0, "-Choose-");
      datatable_object = methodClassFunc.getData("select sub_name from sub_info");
      for (int i = 0; i &lt;= datatable_object.Rows.Count - 1; i++)
      {
          ddlSub.Items.Add(Convert.ToString(datatable_object.Rows[i]["sub_name"]));
      }
  }
  </code></pre>