蓝色信仰

博客园 首页 新随笔 联系 订阅 管理

//TGS_SALEORDERS/Export.aspx页面中,点Export按钮会弹出保存CSV文件的对话框,然后页面应该重新绑定sales orders列表,但是后台在response csv文件给客户端后就response.end()了,需要在前台页面里用javascript来刷新,Export按钮是Dynanmic button配置出来的动态按钮, <%= btnExport.ClientID%>找不到,所有用了foreach方法。

<script type="text/javascript"> 
    function myrefresh() {
    window.location.reload();
    }
    function btnExportClick() {
        setTimeout("refreshP()", 1500); //setTimeout只执行一次
    }
    function refreshP() {
        window.location.reload();  //刷新页面
    }   

    (function() {
        var ie = !!(window.attachEvent && !window.opera);
        var wk = /webkit\/(\d+)/i.test(navigator.userAgent) && (RegExp.$1 < 525);
        var fn = [];
        var run = function() { for (var i = 0; i < fn.length; i++) fn[i](); };
        var d = document;
        d.ready = function(f) {
            if (!ie && !wk && d.addEventListener)
                return d.addEventListener('DOMContentLoaded', f, false);
            if (fn.push(f) > 1) return;
            if (ie)
                (function() {
                    try { d.documentElement.doScroll('left'); run(); }
                    catch (err) { setTimeout(arguments.callee, 0); }
                })();
            else if (wk)
                var t = setInterval(function() {
                    if (/^(loaded|complete)$/.test(d.readyState))
                        clearInterval(t), run();
                }, 0);
        };
    })(); //在javascript中实现document.ready


    document.ready(function() {
    //var btnExport='<%= new DynamicControl(this, "btnEXPORT").ClientID %>' //can not find,why?
    //document.getElementById(btnEXPORT).value = "test";
    var inputs = document.getElementsByTagName("input");
    for (i = 0; i < inputs.length; i++) {
        if (inputs[i].title == "Export[Alt+X]") {
            inputs[i].setAttribute("onclick", btnExportClick);
            }
        }
    });
</script>

posted on 2013-02-06 09:42  蓝色信仰  阅读(2443)  评论(0编辑  收藏  举报