喵-见缝插针 2009-06-16 08:13 采纳率: 0%
浏览 91

ASP.net页面加载弹出窗口

I was wondering if it is possible to have a modalpopup show up on page load, saying that the page is loading. I have a page that gets a lot of data from an external source which means it takes a bit before any of the controls are actually filled. I would like to have a popup or something similar that tells the user the page is loading.

I tried this:

<ajax:ModalPopupExtender ID="mpeLoader" runat="server" TargetControlID="btnLoader"
    PopupControlID="pnlLoading" BackgroundCssClass="modalBackground" />
<asp:Panel ID="pnlLoading" runat="server" Width="100px" Style="display: none;">
    <div class="detailspopup">
        <table>
            <tr>
                <td><asp:Image ID="imgLoader" runat="server" ImageUrl="~/App_Themes/Main/img/loading.gif" /></td>
            </tr>
            <tr>
                <td>Loading...</td>
            </tr>
        </table>
    </div>
</asp:Panel>

with a dummy button btnLoader to allow me to access the show and hide from code behind. I've been toying with the .show method in the page lifecycle but I can't seem to find a way to have the poopup show when the page is loading (and disappear when loading is done). This would also be needed upon filtering the data, thus getting new data based on filter data.

  • 写回答

3条回答 默认 最新

  • ℡Wang Yan 2009-06-16 08:21
    关注

    Hard to say what the best solution is without more information, but one possible way to go is to make the first page just act as a "loader" containing the dialog and some javascript that will load the actual page with ajax.

    Like I wrote before it depends very much on what you are trying to accomplish :-) !

    But one way to do it with jQuery, if the page you are trying to load is very simple like a list without any state / postback controls is to create a "Loader"-page like the code belov and use the UrlToLoad query param for what page to load dynamically.

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title></title>
    
        <script src="jquery.js" type="text/javascript"></script>
    
        <script type="text/javascript">
            $(function()
            {
                $("form").load("<%= this.Request["UrlToLoad"] %> form");
            });
        </script>
    </head>
    
    <body>
        <form runat="server">           
            Loading...
        </form>
    </body>
    

    评论

报告相同问题?

悬赏问题

  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 matlab求解平差
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办