box =new CheckBoxList();
string strcon2=System.Configuration.ConfigurationSettings.AppSettings["strCon"];
SqlConnection cn=new SqlConnection(strcon2);
DataSet ds=new DataSet(); if(this.paper_topics.SelectedValue=="C")
{
string query1="select * from Class where C_str='C'";
SqlCommand cmd=new SqlCommand(query1,cn);
cmd.Connection.Open();
SqlDataReader dr=cmd.ExecuteReader();
if(dr.Read())
{
Session["leibie"]=dr["C_ID"].ToString(); }
cmd.Connection.Close(); string query="select * from Class  where C_fatherID='1'";
SqlDataAdapter da=new SqlDataAdapter(query,cn);
da.Fill(ds,"linshi");
box.DataSource=ds.Tables["linshi"];
box.DataTextField=ds.Tables["linshi"].Columns["C_name"].ToString();
box.DataValueField=ds.Tables["linshi"].Columns["C_ID"].ToString();
box.DataBind();
Session["path"]="C";
}

if(this.paper_topics.SelectedValue=="D")
{
string query1="select * from Class where C_str='D'";
SqlCommand cmd=new SqlCommand(query1,cn);
cmd.Connection.Open();
SqlDataReader dr=cmd.ExecuteReader();
if(dr.Read())
{
Session["leibie"]=dr["C_ID"].ToString();
}
cmd.Connection.Close(); string query="select * from Class where C_fatherID='2'";
SqlDataAdapter da=new SqlDataAdapter(query,cn);
da.Fill(ds,"linshi");
box.DataSource=ds;
box.DataTextField=ds.Tables["linshi"].Columns["C_name"].ToString();
box.DataValueField=ds.Tables["linshi"].Columns["C_ID"].ToString();
box.DataBind();
Session["path"]="D";

}
box.RepeatDirection=RepeatDirection.Vertical;
box.ForeColor=Color.Orange;
box.ID="box1";

this.Panel1.Controls.Add(box);
我想初始化几个选项,我是这么写的
this.box.Items.FindByText(dr6["P_childclass1"].ToString()).Selected=true;
dr6["P_childclass1"].ToString()).这个为数据库里读出的数据,是正确的,但是这样写运行的时候总是说
未将对象引用设置到对象的实例。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误: 
行 74:  if(dr6["P_childclass2"].ToString()=="")
行 75:  {
行 76:  box.Items.FindByText(dr6["P_childclass1"].ToString()).Selected=true;
行 77:  }
行 78:  else
 请问是怎么回事啊