Lazy-Load on ModalPopup

This is the scenario: we have a Data control inside the Modal div, and we don’t want all the data inside this modal popup to be loaded when the main page is loaded. We want them to be loaded when the user decides to bring out the popup the first time.

  • If Visible is set to “false” for the Data controls, no data binding is performed.
  • A update panel is needed right inside the modal div
  • Since any control that is the TargetControlID of the ModalPopupExtender conceals all the code-behind server-side actions, we won’t assign TargetControlID, but instead associate some JavaScript to a control (most likely button) to bring up the modal popup.
    $find(“<%=ModalPopupExtender1.ClientID %>”).show();
    Note: This is assuming that you know the ModalPopupExtender’s ID on server
  • Also be aware that a control’s Client-side script always runs before Server-side script

To run JavaScript from the server side:

By Bryan Xu

Posted in Ajax Controls

Leave a Reply