Link to home
Start Free TrialLog in
Avatar of alik13
alik13Flag for United States of America

asked on

Getting error when use AJAX UpdatePanel

Hello,
  On a Button_Click event  I need to make visible Panel control that contains User control. Both Button and
Panel controls wrapped by UpdatePanels. I defined a Trigger on the UpdatePanel that contains Panel to be  visible in response to the Click event. but when I click on the button I get the error msg.

Here the code:

For the Button

<ajax:UpdatePanel ID="UpdatePanel1" runat="server">
                                <ContentTemplate>
                                    <asp:Button ID="btnAddNewRecord" runat="server" Text="Add Record" OnClick="btnAddNewRecord_Click" />
                                </ContentTemplate>
                            </ajax:UpdatePanel>

And for the Panel that should become visible in response to the Button_Click event:

 <ajax:UpdatePanel ID="upnlAddRecordBase" runat="server">
        <ContentTemplate>
            <asp:Panel ID="pnlAddRecord" runat="server" Height="74px" Visible="False" Width="702px">
                <uc1:AddRecord ID="AddRecord1" runat="server" />
            </asp:Panel>
        </ContentTemplate>
        <Triggers>
          <ajax:AsyncPostBackTrigger ControlID ="btnAddNewRecord" EventName ="Click" />
        </Triggers>
    </ajax:UpdatePanel>

Please help!



 
 
Avatar of divinewind80
divinewind80

What error are you getting?
Avatar of alik13

ASKER

The error is :

Sys. InvalidOperationException:Could not find UpdatePanel with ID 'ctl00_ContentPlaceHolder1_upnlAddRecordBase' If it is being updated dynamically then it must be inside another UpdatePanel

Thank you
Avatar of alik13

ASKER

Any help on this error guys???
Can you put both inside of the the same UpdatePanel?  I know that UpdatePanels often having trouble communicating with each other, so to speak...
Avatar of alik13

ASKER

Unfortunatelly no, because  by design  the Button should be placed on top of the page on a different UpdatePanel....
ASKER CERTIFIED SOLUTION
Avatar of divinewind80
divinewind80

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alik13

ASKER

Thanks I will try it.
Try setting  UpdateMode="Conditional" for panel upnlAddRecordBase