Popular Posts

Friday, 8 July 2011

Model Popup on Loading ASP.Net Page

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>


<style type="text/css">
        .modalBackground
        {
             background-color:#3E3535;
                    filter:alpha(opacity=60);
                    opacity:0.60;
        }
    </style>


<script language="javascript" type="text/javascript">
    function pageLoad() {
        ShowPopup();
        setTimeout(HidePopup, 2000);
    }

    function ShowPopup() {
        $find('modalpopup').show();
        //$get('Button1').click();
    }

    function HidePopup() {
        $find('modalpopup').hide();
        //$get('btnCancel').click();
    }
</script>

</ContentTemplate></asp:updatepanel>
            
       <asp:Panel ID="pnlProgress" runat="server" Height="55px" Width="321px"  
        BackImageUrl="../Images/Loading.jpg" style=" display:none;"  >
            <div  >
                <table  width="100%" style="height: 55px; width: 77px;">
                    <tbody>
                        <tr>
                            <td style="text-align: right">
                                <img alt="" src="../Images/indicator-big.gif" />
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </asp:Panel>
       
       
       
       
        <cc1:ModalPopupExtender ID="mpeProgress" runat="server" TargetControlID="pnlProgress" PopupControlID="pnlProgress" BackgroundCssClass="modalBackground" DropShadow="false" />
       
       
        </div>
       
          <script type="text/javascript">

        Sys.Net.WebRequestManager.add_invokingRequest(onInvoke);
        Sys.Net.WebRequestManager.add_completedRequest(onComplete);

        function onInvoke(sender, args)
        {
            $find('<%= mpeProgress.ClientID %>').show();
        }

        function onComplete(sender, args)
        {
            $find('<%= mpeProgress.ClientID %>').hide();
        }

        function pageUnload()
        {
            Sys.Net.WebRequestManager.remove_invokingRequest(onInvoke);
            Sys.Net.WebRequestManager.remove_completedRequest(onComplete);
        }

    </script> 
  
  
    </form>

No comments:

Post a Comment