Search Web

Monday, September 5, 2011

Show/Hide ModalPopup Using Javascript.

The Asp.net Markup :

<asp:panel id="pnlDemo" runat="server" style="display: none;">
 <h1> This panel is a test demo</h1> </asp:panel>


 <cc1:modalpopupextender backgroundcssclass="modalBlockBackground" behaviorid="ModalPopupExtender" dynamicservicepath="" enabled="True" id="ModalPopupExtender" popupcontrolid="pnlDemo" runat="server" targetcontrolid="linkButton1"> </cc1:modalpopupextender>

If we want to use the javascript to control the popup, we can just simply to write the code like this:


  if(!show)
    {
      $find('ModalPopupExtender').hide();
    }
    else
    {
        $find("ModalPopupExtender").show();
       }


There is one thing need to be taken care which is the BehavirID, the code in the Javasctipt will look for the BehaviorID property for the ModalPopupExtender.

I hope this can be helpful for you.

1 comments:

obat jerawat said...

postingan yang bagus tentang"Show/Hide ModalPopup Using Javascript."

Post a Comment