rgssq
rgssq
2016-03-19 15:56

ajaxtoolkit:accordion显示问题

  • accordion

我现在在使用ajaxtoolkit:accordion显示菜单(包含子菜单),菜单项为accordionpane,菜单项放入accordionpane的headercontainer里,如果还有子菜单,则子菜单放入
contentcontainer中,问题是,没有子菜单的菜单项点击时候,也会稍微显示一下contentcontainer,即感觉到contentcontainer虽然没有内容,但是还是会稍微占据一点空间
private void CreateMenu()
{
int usertype = int.Parse(Session["UserID"].ToString());

    foreach(object m in GetMenuItem(usertype,0)){
        AccordionPane pan = new AccordionPane();
        Label lb = new Label();
        lb.Text = DataBinder.Eval(m,"mname","");
        pan.HeaderContainer.Controls.Add(lb);
        pan.ContentContainer.Height = 500;
        if (DataBinder.Eval(m, "missub","") == "True" )
        {

            foreach(object n in GetMenuItem(usertype,int.Parse(DataBinder.Eval(m,"mid",""))))
            {
                Label tem =  new Label();
                tem.Text = DataBinder.Eval(n,"mname","");
                pan.ContentContainer.Controls.Add(tem);
            }
        }
        accr.Panes.Add(pan);

    }

}
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答