二级目录:
public void SetProductCategory(DropDownList drp, int selectID)
        {
            drp.Items.Clear();
            foreach (Category c1 in CompanyInfo.GetCategory())       //CompanyInfo.GetCategory取得一级目录
            {
                foreach (Category c2 in CompanyInfo.GetCategory(c1.ID))
                {
                    drp.Items.Add(new ListItem(c1.Name.PadRight(10, '-') + c2.Name.PadLeft(10, ' '), c2.ID.ToString()));
                    
                }
            }
            if (selectID == 0)
                return;
            ListItem item = drp.Items.FindByValue(selectID.ToString());
            if (item != null)
                item.Selected = true;
        }上面显示正常,三级目录:public void SetProductCategory(DropDownList drp, int selectID)
        {
            drp.Items.Clear();
            foreach (Category c1 in CompanyInfo.GetCategory())
            {
                foreach (Category c2 in CompanyInfo.GetCategory(c1.ID))
                {
                    foreach (Category c3 in CompanyInfo.GetCategory(c2.ID))
                    {
                        drp.Items.Add(new ListItem(c1.Name.PadRight(10, '-') + c2.Name.PadRight(10, '-') + c3.Name.PadLeft(10, ' '), c3.ID.ToString()));
                    }                }
            }
            if (selectID == 0)
                return;
            ListItem item = drp.Items.FindByValue(selectID.ToString());
            if (item != null)
                item.Selected = true;
        }
改了之后重新编译,还是原来一样的显示效果,是不是我没编译好,我对VS2005不太熟悉,请教大虾!