开发者

How to use AJAXControlToolkit’s Modelpopu with ConfirmDialog?

开发者 https://www.devze.com 2023-02-22 11:13 出处:网络
I am trying to use AJAXControlToolkit’s Modelpopu with ConfirmDialog.I am using VS2008. Following is my code

I am trying to use AJAXControlToolkit’s Modelpopu with ConfirmDialog.I am using VS2008. Following is my code

<asp:Button ID="btnSave" runat="server" Text="Save" onclick="btnSave_Click" />
<asp:ConfirmButtonExtender ID="btnSave_ConfirmButtonExtender" runat="server" 
         ConfirmText="Want to Save?" Enabled="True" TargetControlID="btnSave">
</asp:ConfirmButtonExtender>
<asp:ModalPopupExtender ID="btnSave_ModalPopupExtender" runat="server" 
          DynamicServicePath="" Enabled="True" TargetControlID="btnSave">
</asp:ModalPopupExtender>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:Too开发者_开发百科lkitScriptManager>

Please guide me what should I do to make it run.


From the AJAX Control Toolkit documentation for the ConfirmButtonExtender: http://www.asp.net/ajax/ajaxcontroltoolkit/samples/ConfirmButton/ConfirmButton.aspx

  • DisplayModalPopupID - Optionally specifies the ID of a ModalPopup control to use for displaying the confirmation dialog (instead of window.confirm). When using DisplayModalPopupID, the following conditions must be met:
    • The ModalPopup must be configured to work against the same TargetControlID as the ConfirmButton (and should work properly if the ConfirmButton is disabled).
    • The ModalPopup must specify OkControlID and/or CancelControlID to identify the buttons corresponding to window.confirm's OK/Cancel buttons.
    • The ModalPopup must not specify OnOkScript or OnCancelScript.

Example of using the AJAX controls together in your page:

<asp:ConfirmButtonExtender ID="btnSave_ConfirmButtonExtender" runat="server"
    ConfirmText="Want to Save?" TargetControlID="btnSave" 
    DisplayModalPopupID="btnSave_ModalPopupExtender"></asp:ConfirmButtonExtender>
<asp:ModalPopupExtender ID="btnSave_ModalPopupExtender" runat="server"
    TargetControlID="btnSave" PopupControlID="Panel1"
    OkControlID="btnOK" CancelControlID="btnCancel"></asp:ModalPopupExtender>

Where Panel1 is an <asp:Panel> that gets displayed as the modal dialog, and btnOK and btnCancel are the OK and Cancel buttons on that panel.

0

精彩评论

暂无评论...
验证码 换一张
取 消