ModalPopup Demonstration


ModalPopup Description:

The ModalPopup extender allows a page to display content to the user in a "modal" manner which prevents the user from interacting with the rest of the page. The modal content can be any hierarchy of controls and is displayed above a background that can have a custom style applied to it. When displayed, only the modal content can be interacted with; clicking on the rest of the page does nothing. When the user is done interacting with the modal content, a click of an OK/Cancel control dismisses the modal content and optionally runs custom script. The custom script will typically be used to apply whatever changes were made while the modal mode was active. If a postback is required, simply allow the OK/Cancel control to postback and the page to re-render. You can also absolutely position a modal popup by setting the X and Y properties. By default it is centered on the page, however if just X or Y is specified then it is centered vertically or horizontally.

ModalPopup Properties:

The control above is initialized with this code. The display on the modal popup element is set to none to avoid a flicker on render. The italic properties are optional:

<ajaxToolkit:ModalPopupExtender ID="MPE" runat="server"
    TargetControlID="LinkButton1"
    PopupControlID="Panel1"
    BackgroundCssClass="modalBackground"
    DropShadow="true"
    OkControlID="OkButton"
    OnOkScript="onOk()"
    CancelControlID="CancelButton"
    PopupDragHandleControlID="Panel3" />

    * TargetControlID - The ID of the element that activates the modal popup
    * PopupControlID - The ID of the element to display as a modal popup
    * BackgroundCssClass - The CSS class to apply to the background when the modal popup is displayed
    * DropShadow - True to automatically add a drop-shadow to the modal popup
    * OkControlID - The ID of the element that dismisses the modal popup
    * OnOkScript - Script to run when the modal popup is dismissed with the OkControlID
    * CancelControlID - The ID of the element that cancels the modal popup
    * OnCancelScript - Script to run when the modal popup is dismissed with the CancelControlID
    * PopupDragHandleControlID - The ID of the embedded element that contains the popup header/title which will be used as a drag handle
    * X - The X coordinate of the top/left corner of the modal popup (the popup will be centered horizontally if not specified)
    * Y - The Y coordinate of the top/left corner of the modal popup (the popup will be centered vertically if not specified)
    * RepositionMode - The setting that determines if the popup needs to be repositioned when the window is resized or scrolled.

0 comments:

Post a Comment