alik13
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_C lick" />
</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!
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_C
</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
</Triggers>
</ajax:UpdatePanel>
Please help!
What error are you getting?
ASKER
The error is :
Sys. InvalidOperationException: Could not find UpdatePanel with ID 'ctl00_ContentPlaceHolder1 _upnlAddRe cordBase' If it is being updated dynamically then it must be inside another UpdatePanel
Thank you
Sys. InvalidOperationException:
Thank you
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...
ASKER
Unfortunatelly no, because by design the Button should be placed on top of the page on a different UpdatePanel....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks I will try it.
Try setting UpdateMode="Conditional" for panel upnlAddRecordBase