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!



 
 
alik13Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

divinewind80Commented:
What error are you getting?
0
alik13Author Commented:
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
0
alik13Author Commented:
Any help on this error guys???
0
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

divinewind80Commented:
Can you put both inside of the the same UpdatePanel?  I know that UpdatePanels often having trouble communicating with each other, so to speak...
0
alik13Author Commented:
Unfortunatelly no, because  by design  the Button should be placed on top of the page on a different UpdatePanel....
0
divinewind80Commented:
I wonder if you would be able to place your button panel inside a div and attempt to make it visible through a Javascript function from the other panel rather than directly using AJAX to do.

For instance, you could set a hiddenfield with a value of false in the main updatepanel.  Then, on your button's click, set it equal to true.  In the meantime, have a Javascript running every few seconds to check the field's value... if it is true, tell the div to be visible, otherwise stay hidden.

Not sure if it would work, but it would be worth a shot, I think, as a workaround.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
alik13Author Commented:
Thanks I will try it.
0
otstechsCommented:
Try setting  UpdateMode="Conditional" for panel upnlAddRecordBase
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.