title: String was not recognized as a valid DateTime12
body: <p>here I bind date (from table) in drop down list in this format 2015, and want to populate data in grid view when the date in grid view equal to selected value in drop down list. Error says "String was not recognized as a valid DateTime". Error in this line </p>
  
  <pre><code> cmd.Parameters.AddWithValue("@eventDate", DateTime.Parse(ddlLocation.SelectedValue));
  </code></pre>
  
  <p>This is the drop down list code </p>
  
  <pre><code> SqlCommand cmd = new SqlCommand("SELECT DATEPART(yyyy, eventDate) AS eventDate FROM events group by eventDate", con);
          SqlDataAdapter da = new SqlDataAdapter(cmd);
          da.Fill(dt);
          con.Close();
          ddlLocation.DataSource = dt;
          ddlLocation.DataTextField = "eventDate";
         ddlLocation.DataValueField = "eventDate";
          ddlLocation.DataBind();
          ddlLocation.Items.Insert(0, new ListItem("All", ""));
  </code></pre>
  
  <p>and this is grid view code:</p>
  
  <pre><code> SqlCommand cmd = new SqlCommand("select id, eventDate, eventName from events where eventDate = @eventDate", con);
       cmd.Parameters.AddWithValue("@eventDate", DateTime.Parse(ddlLocation.SelectedValue));
       SqlDataAdapter da = new SqlDataAdapter(cmd);
       da.Fill(dt);
       }
       else
       {
       SqlCommand cmd = new SqlCommand("select id, eventDate, eventName from events", con);
       SqlDataAdapter da = new SqlDataAdapter(cmd);
       da.Fill(dt);
       }
        con.Close();
       gvDetails.DataSource = dt;
       gvDetails.DataBind();
     }
  </code></pre>