asp.net连接打印报表Grid+Report5.0

.aspx主文档引用以下脚本: 

<script type="text/javascript" src="../js/RepairManage/RepairStock.js"></script>

..................

 <input type="button" id="btnPrint" class="button_bak" value="打 印" />

..................

 

RepairStock.js文件内容如下:

$(document).ready(function() {
    $('#__AjaxCall_Wait').hide();
    $(".tab_content").hide();
    $("ul.tabs li:first").addClass("active").show();
    $(".tab_content:first").show();
    $("ul.tabs li").click(function() {
        $("ul.tabs li").removeClass("active");
        $(this).addClass("active");
        $(".tab_content").hide();
        var activeTab = $(this).find("a").attr("href");
        $('#txtCurTab').val(activeTab == '#tab1' ? "0" : "1");
        $(activeTab).show();
        return false;
    });
    $('#btnreset').live("click", function() {
        $('input[type=text]').val('');
        $('select').val('');
    })
    $('#btnPrint').live('click', function() {
        if (RightCheck("RepairStock.aspx", "allow_print") == false) {
            return false;
        }
        var params = {
            shop_no: $('#cbshop_no').val(),
            gold_no: $('#cbgold_no').val(),
            style_no: $('#txtstyle_no').val(),
            mstone_no: $('#cbstone_no').val(),
            kind_no: $('#cbkind_no').val(),
            date_min: $('#txtdate_min').val(),
            date_max: $('#txtdate_max').val(),
            goodswgt_min: $('#txtgoodswgt_min').val(),
            goodswgt_max: $('#txtgoodswgt_max').val(),
            mstone_min: $('#txtmstonewgt_min').val(),
            mstone_max: $('#txtmstonewgt_max').val()
        }
        try{
            parent.Report.LoadFromURL("../../Report/RepairStock.grf");
            parent.Report.LoadDataFromURL("../../Handler/RepairManage/RepairStockPrint.ashx?"+$.param(params));
            parent.Report.PrintPreview(true);
        }catch(err){
            alert('打印操作失败,请确认安装了打印插件 !');
            history.go(-1);
        }
    })
})

 

 

.ashx里面的主要内容:

public void ProcessRequest(HttpContext context)
{

...................

string json = string.Empty;
json = bll.GetRepairStockStr(shop_no, gold_no, style_no, mstone_no, kind_no, date_min, date_max, goodswgt_min, goodswgt_max, mstonewgt_min, mstonewgt_max);
context.Response.Write(json);

}
public bool IsReusable
{
    get
    {
        return false;
    }
}

你可能感兴趣的:(asp.net连接打印报表Grid+Report5.0)