我不得不降下来,其执行代码列表时,特定的条件,我试图通过选择值来检查它,但它得到错误下拉列表中选中
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();
}
}
}
而错误是? – womp 2010-04-19 16:06:15
对象引用不是实例..... – Myworld 2010-04-19 16:16:26
您应该包含(至少一部分)堆栈跟踪。有任何数量的东西都可能无效。 – R0MANARMY 2010-04-19 16:20:00