Reputation: 2192
I want to show modal popup after I click the Save button to save values in DB and while showing modal popup, it should continue saving, without closing modal popup I am using this code
protected void btsave_Click(object sender, EventArgs e)
{
ModalPopupExtender1.Show();
//My Code
}
and my aspx code
<input type="button" runat="server" id="btmodel" style="display: none" />
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btmodel"
PopupControlID="Panel1" PopupDragHandleControlID="PopupHeader" Drag="true" DropShadow="true"
OkControlID="OkButton" CancelControlID="CancelButton" BackgroundCssClass="ModalPopupBG">
</ajaxToolkit:ModalPopupExtender>
<asp:Panel ID="Panel1" Style="display: none" runat="server">
<div class="progress-popup">
<div class="potit">
Saving
</div>
<img src="/images/prog.png" alt="" style="margin: 0 auto; display: block;" />
<div class="potit-cancel">
<span class="cncl">
<asp:Button ID="btnOkay" runat="server" Text="Ok" OnClick="btnOkay_Click" ValidationGroup="vg"
CssClass="popupcancl" />
</span>
</div>
</div>
</asp:Panel>
With this code, It first Saving Data in DB, then showing Modalpopup
Upvotes: 2
Views: 5558
Reputation: 714
add a hidden field on your page. Assign to it a value (let say, 'showed') when you press the button and then, in page_load, with string.compare, see if the value of the hidden field is 'showed'. If it is, then show again the modal control. When you press the cancel button, delete the value from hidden field (make it string.empty).
Upvotes: 1