暮雨

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

前台只需这样写即可。

<ItemTemplate>
<asp:LinkButton ID="lbtnApplyNo" runat="server"  Text="打印" 
OnClientClick='<%# Eval("ApplyNo","ShowApply(\"ShippingApplyPrint.aspx?ApplyNo={0}\");return false;") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>

function ShowApply(url, width, height) {
    var dialogInfo = "";
    if (width > 0) {
        dialogInfo = "dialogWidth=" + width + "px;dialogHeight=" + height + "px";
    }
    else {
        dialogInfo = "dialogWidth=760px;dialogHeight=700px";
    }
    url = url + "&rn=" + Math.random();//使路径改变原来状态值。Math.random()是产生随机说的方法
    if (window.showModalDialog != null)//IE判断
    {
        var result = window.showModalDialog(url, "", dialogInfo);//传路径和模式窗体的高和宽
        if (result) {
            var urlParts = document.URL.split("?");
            var isUrl = window.location.href;
            if (urlParts[1]) {
                isUrl = isUrl.replace(/contractNo=[^&]*/i, "ApplyNo=").replace(/sid=[^&]*/g, "sid=" + parseInt(10 * Math.random()));
            }
            else {
                isUrl = isUrl.replace(/contractNo=[^&]*/i, "ApplyNo=").replace(/sid=[^&]*/g, "sid=" + parseInt(10 * Math.random()));
            }
            window.location.href = isUrl;
            //window.document.forms[0].submit();
        }
        return true;
    }
    window.open(url, "", "height=400px,width=800px");
    return true;
}

 这是实现模式窗体效果。

效果:

 

posted on 2011-08-23 11:08  蕙草  阅读(954)  评论(0编辑  收藏  举报