关于面板选择的折叠面板

时间:2010-02-23 19:37:40

标签: select panel collapsiblepanelextender

我对崩溃面板有疑问..

我有一个占位符,我动态添加了多个headerpanel,contentpanel,collapsiblepanel ..这是我的代码:

    CollapsiblePanelExtender cpe = new CollapsiblePanelExtender();
    Panel pnlheader,pnlcontent;
    Label lblcontent,lblheader; Button btn;
    for (int i = 0; i < 10; i++)
    {
        ///// PANEL HEADER VE ICERIGI //////////
        pnlheader = new Panel();
        pnlheader.ID = "PanelHeader" + i;
        pnlheader.BackColor = System.Drawing.Color.Blue;
        lblheader = new Label();
        lblheader.ID = "LabelHeader" + i.ToString();
        lblheader.Text = (i + 1) + ". Header";

        pnlheader.Controls.Add(lblheader);
        /////////PANEL CONTENT VE ICERIGI //////////
        pnlcontent = new Panel();
        pnlcontent.ID = "PanelContent" + i;
        pnlcontent.BackColor = System.Drawing.Color.DarkRed;
        lblcontent = new Label();
        lblcontent.ID = "LabelContent" + i.ToString();
        lblcontent.Text = "<table><tr><td border=\"1\">DENEMEE</td></tr></table>";
        btn = new Button();
        btn.ID = "Button" + i.ToString();
        btn.Text = "Deneme.Button";
        pnlcontent.Controls.Add(lblcontent);
        pnlcontent.Controls.Add(btn);

        ///////// COLLAPSEPANEL ICERIGI///////
        cpe = new CollapsiblePanelExtender();
        cpe.ID = "CollapsePanel" + i;
        cpe.TargetControlID = "PanelContent" + i;
        cpe.ExpandControlID = "PanelHeader" + i;
        cpe.CollapseControlID = "PanelHeader" + i;
        PlaceHolder2.Controls.Add(pnlheader);
        PlaceHolder2.Controls.Add(pnlcontent);
        PlaceHolder2.Controls.Add(cpe);
    }

我如何理解扩展哪个面板..

非常重要,请帮助..

1 个答案:

答案 0 :(得分:0)

首先,您应该在PlaceHolder2的范围内找到CollapsiblePanelExtender类型的所有控件。 然后,您将能够获得每个找到的CollapsiblePanelExtender实例的Collapsed属性。