AJAX Control Toolkit: ModalPopup as Action confirmation

So, there is possible to treat regular ASP Panel as modal popup dialog. And even use that one as confirmation dialog instead of standard JS confirm().
I think it’s ok to use standard one in almost all case.
But if it needs custom one like in today case, then it may be used like this below.
Also, there is standard OnClienClick=”” (means regual onclick=””) to do the same but mach more easy and faster.

// ModalPopupExtender and ConfirmButtonExtender

<%– Delete Confirmation Popup Panel –%>
<asp:Panel ID=”pnlDelConfirm” runat=”server”>
Are you sure you want to delete this game?
<asp:LinkButton ID=”btnDelConfirmDelete” runat=”server” Text=”Delete” />
<asp:LinkButton ID=”btnDelConfirmCancel” runat=”server” Text=”Cancel” />
</asp:Panel>

<%–
Button. We trigger confirmation on this button action.
Standard OnClientClick is used when page is still loading to provide regular JS confirm instrad of our custom ModelPopup
–%>
<asp:Button ID=”btnDelete” runat=”server” Text=”Delete” CommandName=”Delete” CausesValidation=”true”
OnClientClick=”return confirm(‘Are you sure you want to delete this game?’);” />

<atk:ConfirmButtonExtender ID=”ConfirmButtonExtender1″ runat=”server”
TargetControlID=”btnDelete” DisplayModalPopupID=”mdlDelConfirm”>
</atk:ConfirmButtonExtender>

<atk:ModalPopupExtender ID=”mdlDelConfirm” runat=”server” TargetControlID=”btnDelete”
BackgroundCssClass=”modalBackground” PopupControlID=”pnlDelConfirm” OkControlID=”btnDelConfirmDelete” CancelControlID=”btnDelConfirmCancel”>
</atk:ModalPopupExtender>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: