Ajax Accordion - 找到了具有相同ID“_content”的多个控件

时间:2010-09-08 11:28:06

标签: ajax accordion

我正在为手风琴控制动态添加手风琴窗格。当我添加单个窗格时没问题但是尝试添加第二个窗格我得到了例外:找到了具有相同ID“_content”的多个控件

我已尝试按如下方式为窗格分配唯一ID,但不是喜悦。有人可以帮忙吗?

由于

罗布。

if (User.IsInRole(@"arcpet\RDLM – Tradecapture Initial Margin Users – Security"))

{         //为窗格构建标题         AccordionPane pneTCaptureInitalMargin = new AccordionPane();         pneTCaptureInitalMargin.HeaderContainer.Controls.Add(new LiteralControl(“(TCIM)T / Capture Initial Margin”));         pneTCaptureInitalMargin.ID =“AccordionPane”+ Guid.NewGuid()。ToString();         pneTCaptureInitalMargin.HeaderContainer.ID =“HeaderContainer”+ Guid.NewGuid()。ToString();

    //build content for pane
    pneTCaptureInitalMargin = AddHyperLink("Trade Books & Markers", "TradeBook/TradeBook.aspx?4", pneTCaptureInitalMargin);
    acc.Panes.Add(pneTCaptureInitalMargin);

    pneTCaptureInitalMargin = AddHyperLink("+Create New Records", "TradeBook/TradeBookDetail.aspx?acPane=4&type=new", pneTCaptureInitalMargin);
    acc.Panes.Add(pneTCaptureInitalMargin);

    pneTCaptureInitalMargin = AddHyperLink("Bache Account Mappings", "BacheAccount/BacheAccountSettings.aspx?4", pneTCaptureInitalMargin);
    acc.Panes.Add(pneTCaptureInitalMargin);

    pneTCaptureInitalMargin = AddHyperLink("+Create New Record", "BacheAccount/BacheAccountSettingsDetail.aspx?acPane=4&type=new", pneTCaptureInitalMargin);
    acc.Panes.Add(pneTCaptureInitalMargin);

    pneTCaptureInitalMargin = AddHyperLink("Run DI Job", "AjaxBODI.aspx?acPane=0&subject=refTradeBook", pneTCaptureInitalMargin);
    acc.Panes.Add(pneTCaptureInitalMargin);
}

if (User.IsInRole(@"arcpet\RDLM – Cash Utilisation Users – Security"))
{
    //build header for pane
    AccordionPane pneCashUtilisation = new AccordionPane();
    pneCashUtilisation.HeaderContainer.Controls.Add(new LiteralControl("(CU) Cash Utilisation"));
    pneCashUtilisation.ID = "AccordionPane" + Guid.NewGuid().ToString();
    pneCashUtilisation.HeaderContainer.ID = "HeaderContainer" + Guid.NewGuid().ToString();

    //build content for pane
    pneCashUtilisation = AddHyperLink("Trade Books & Markers", "TradeBook/TradeBook.aspx?5", pneCashUtilisation);
    acc.Panes.Add(pneCashUtilisation);

    pneCashUtilisation = AddHyperLink("+Create New Records", "TradeBook/TradeBookDetail.aspx?acPane=5&type=new", pneCashUtilisation);
    acc.Panes.Add(pneCashUtilisation);

    pneCashUtilisation = AddHyperLink("Trade Book Overheads", "TradeBook/TradeBookOverhead.aspx?5", pneCashUtilisation);
    acc.Panes.Add(pneCashUtilisation);

    pneCashUtilisation = AddHyperLink("+Create New Record", "TradeBook/TradeBookOverheadDetail.aspx?acPane=5&type=new", pneCashUtilisation);
    acc.Panes.Add(pneCashUtilisation);

    pneCashUtilisation = AddHyperLink("Run DI Job", "AjaxBODI.aspx?acPane=0&subject=refTradeBook", pneCashUtilisation);
    acc.Panes.Add(pneCashUtilisation);
}

1 个答案:

答案 0 :(得分:3)

修正了它!不知道为什么,但在声明后(在下一行)直接分配PaneId是至关重要的。