title: Dropdownlist date format
body: <p>I am using a DataTable to populate a dropdownlist on my web form, as well as using a stored procedure to query the database.  The list retrieves only one field from the database and will be used in conjunction with a gridview to view all reservations made on a specific date.  </p>
  
  <p>Everything works fine, except for the format of the date.  Right now it is showing the date as well as hours, minutes, and seconds. I have tried using the DataFormatString property the the web form but no luck.  </p>
  
  <p>Webform:</p>
  
  <pre><code>  &lt;b&gt;Please select a date:&lt;/b&gt;
    &lt;asp:DropDownList ID="ddlDateSelection" runat="server" DataFormatString="{0:MM/dd/yyyy}"&gt;&lt;/asp:DropDownList&gt;
    &lt;br /&gt;
    &lt;asp:Label ID="lblError" runat="server" CssClass="validate"&gt;&lt;/asp:Label&gt;
  </code></pre>
  
  <p>code behind used to query database:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
      {
    if (!Page.IsPostBack)
      loadDates();
  }
  
  protected void loadDates()
  {
    DataTable dates = new DataTable();
  
    using (SqlConnection con = new SqlConnection(DBAccess.GetConnectionString()))
    {
      SqlCommand cmd = new SqlCommand("usp_sel_ReservationDates", con);
      cmd.CommandType = CommandType.StoredProcedure;
  
      try
      {
        SqlDataAdapter adapter = new SqlDataAdapter(cmd);
        adapter.Fill(dates);
        ddlDateSelection.DataSource = dates;
        ddlDateSelection.DataTextField = "ReservationDate";
        ddlDateSelection.DataBind();
      }
      catch (Exception ex)
      {
        lblError.Text = "Something bad has happened.  Please try again.&lt;br /&gt;Message: " + ex;
      }
    }
    ddlDateSelection.Items.Insert(0, new ListItem("Please Select", "0"));
  }
  </code></pre>
  
  <p>Any help would be greatly appreciated, as this is a learning project for myself. Thanks</p>