大家帮忙看一下,我是在一个三级分类信息时这样的~我的结构如下:A
   A1
       A11
       A22
  A2
B
  B1
       B11
C这样的形式在大A下用一个DropDownList1 来控制表格
然后到行A1时,用DropDownList2来控制,并且中间用了一个〈Br>下面再用了DropDownList3来显示A11这样的

解决方案 »

  1.   

    注,我的Big_Id就是上面的DropDownList1 
    Small_Id是DropDownList12
    Small_Small_Id是DropDownList3在运行时,总是说 
    foreach(DataListItem dls in this.Small_Id.Items)这一行出错,请大家帮忙看一下~谢~
    #region 显示大类信息
    private void Big_type()
    {
    DataBaseOperation dbo=new DataBaseOperation(Application["ConnStr"].ToString());
    string sqlText=String.Empty;
    sqlText="select Big_Id,Big_Name from Big_type order by Big_Id ";
    DataTable dtx=dbo.SqlDb.ExecuteRtnTable(sqlText);
    this.Big_Id.DataSource=dtx;
    this.Big_Id.DataBind();
    BindSub(dbo);
    dbo.Dispose();
    }
    #endregion
    private void BindSub(DataBaseOperation dbo)
    {
    string sqlText="select x.Small_Id,x.Small_Name,y.Big_Id from Small_type x,Big_type y where x.Big_Id={0} and y.Big_Id=X.Big_Id order by x.Small_Id";
    foreach(DataListItem dli in this.Big_Id.Items)
    {
    if(dli.ItemType!=ListItemType.Footer&&dli.ItemType!=ListItemType.Header)
    {
    DataList dl=(DataList)dli.FindControl("Small_Id");
    if(dl!=null)
    {
    string sqlText1=String.Format(sqlText,this.Big_Id.DataKeys[dli.ItemIndex]);
    dl.DataSource=dbo.SqlDb.ExecuteRtnTable(sqlText1);
    dl.DataBind();
    BindSub1(dbo);
    }

    }
    }

    } private void BindSub1(DataBaseOperation dbo)
    {
    string sqltxt=string.Empty;
    sqltxt="select x.Small_Small_Id,x.Small_Small_Name,x.Small_Id,x.Big_Id,y.Small_Id from Small_Small_type x,Small_type y where x.Small_Id=1 and y.Small_Id=X.Small_Id  order by x.Small_Small_Id  ";
    foreach(DataListItem dls in this.Small_Id.Items)
    {
    if(dls.ItemType!=ListItemType.Footer&&dls.ItemType!=ListItemType.Header)
    {
    DataList dl_s=(DataList)dls.FindControl("Small_Small_Id");
    if(dl_s!=null)
    {
    string sqlText2=String.Format(sqltxt,this.Small_Id.DataKeys[dls.ItemIndex]);
    dl_s.DataSource=dbo.SqlDb.ExecuteRtnTable(sqlText2);
    dl_s.DataBind();
    }
    }
    }
    }
      

  2.   

    自己解决了,用了一个ASCX页面过来帮着实现了~哎