Modal Popup extender does not work 2nd time when "OK" or "Cancel" button clicked [Resolved]

Posted by Awaisdar001 under ASP.NET AJAX on 9/11/2011 | Points: 10 | Views : 8463 | Status : [Member] | Replies : 1
Modal Popup extender does not work when "OK" or "Cancel" button clicked


i have 2 panels.. i used model popup extender

<div style="background-position: 99% 7px; cursor:pointer">


<asp:Panel runat="server" ID="RootPanel" CssClass="panel" >

<p> <asp:Label ID="Nameh" runat ="server" Text ="Name: "></asp:Label>
<asp:Label ID="Name" runat ="server" Text ="Variable Text "></asp:Label> </p>

</asp:Panel>

</div>

<asp:Panel runat="server" ID="ChildPanel" CssClass="ModelPopupPanel">

<p><label>Name: </label><asp:TextBox ID="TbxName" runat="server" CssClass="tb5"></asp:TextBox></p>

<p><asp:Button runat="server" ID="DoneButton" Text="Done" CssClass="btn">
<asp:Button runat="server" ID="btnCancel" Text="Cancel" CssClass="btn" /> </p>


</asp:Panel>


<asp:ModalPopupExtender ID="AddressRootPanel_ModalPopupExtender" runat="server" BackgroundCssClass="ModelBackground"
DynamicServicePath="" Enabled="True" TargetControlID="RootPanel"
PopupControlID="ChildPanel" DropShadow="True" CancelControlID="btnCancel"
ViewStateMode="Enabled" />

Popup works fine at first when i click on the RootPanel (which is targetControlID of ModalPopupExtendar ).

But problem is when ChildPanel popup and i click on "btnCancel", ChildPanel get closed

and Next time it does not Popup as it did first time ??? Please help




Responses

Posted by: Awaisdar001 on: 9/11/2011 [Member] Starter | Points: 25

Up
0
Down

Resolved
well no one answer but i finally done it Thanks to those who only viewed anyways this is the way to to go.... using an update panel and instead of giving okControlid and CancelControlid in ModalPopupExtender we will use a very simple way which is assinging BtnDone/OKbutto to trigger of Update
Panel.. you can see the how i used it..

<div style="background-position: 99% 7px; cursor:pointer">



<asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional" >
<ContentTemplate>


<asp:Panel runat="server" ID="RootPanel" CssClass="panel" >
<p>
<asp:Label ID="Nameh" runat ="server" Text ="Name: "></asp:Label>
<asp:Label ID="Name" runat ="server" Text ="Variable Text "></asp:Label>
</p>
</asp:Panel>

<asp:ModalPopupExtender ID="AddressRootPanel_ModalPopupExtender" runat="server" BehaviorID="myBehavior1"
BackgroundCssClass="ModelBackground"
DynamicServicePath="" Enabled="True" TargetControlID="RootPanel"
PopupControlID="ChildPanel" DropShadow="True"
ViewStateMode="Enabled" />

</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DoneButton" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnCancel" />
</Triggers>

</asp:UpdatePanel>

</div>

<asp:Panel runat="server" ID="ChildPanel" CssClass="ModelPopupPanel">
<p><label>Name: </label><asp:TextBox ID="TbxName" runat="server" CssClass="tb5"></asp:TextBox></p>
</asp:Panel>

Awaisdar001, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response