drop down list checked
<p>I had Drop down list which execute code when specific condition and I tried to check it through selected value but it get error </p>

<pre><code> protected void DDLProductFamily_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DDLProductFamily.Items.FindByText("Name").Selected == true)
        using (SqlConnection Con = Connection.GetConnection())
        {
            SqlCommand Com = new SqlCommand("GetListViewByProductCategory", Con);
            Com.CommandType = CommandType.StoredProcedure;
            Com.Parameters.Add(Parameter.NewInt("@ProductCategory_Id", DDLProductFamily.SelectedValue.ToString()));
            SqlDataAdapter DA = new SqlDataAdapter(Com);
            DA.Fill(dt);
            DataList1.DataSource = dt;
            DataList1.DataBind();
        }
        else if (DDLProductFamily.Items.FindByText("ProductFamilly").Selected == true)
        {
            using (SqlConnection Con = Connection.GetConnection())
        {
            SqlCommand Com = new SqlCommand("GetListViewByProductFamily", Con);
            Com.CommandType = CommandType.StoredProcedure;
            Com.Parameters.Add(Parameter.NewInt("@ProductFamily_Id", DDLProductFamily.SelectedValue.ToString()));
            SqlDataAdapter DA = new SqlDataAdapter(Com);
            DA.Fill(dt);
            DataList1.DataSource = dt;
            DataList1.DataBind();
        }
        }
    }
</code></pre>
