tags:

views:

15

answers:

1

Hi

I'm dynamically adding accordion panes to an Accordion Control. When I add a single pane, no problem but trying to add 2nd pane I get the exception: *Multiple controls with the same ID '_content' were found*

I've tried assigning unique Ids to the panes as follows but not joy. Can anyone please help?

Thanks

Rob.

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

{ //build header for pane 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);
}
A: 

Fixed it! Don't know why but assigning the PaneId directly after declaration (on the following line) is critical.

Rob Bowman