Asp.Net Web Form 调用Reporting Service

1、aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TransferMoney.aspx.cs" Inherits="BtmsWebApp.report.TransferMoney" MasterPageFile="~/ReportPage.master" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    批量交易信息报表
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <script>
        function show() {
            var s = document.getElementsByTagName("input");
            var test = /^/d{4}-/d{2}-/d{2}$/;
            for (var i = 0; i < s.length; i++) {
                if ((s[i].name.indexOf("BEGINDATE") != -1) || (s[i].name.indexOf("ENDDATE") != -1)) {
                    if (!test.test(s[i].value)) {
                        alert("日期不能为空");
                        return false;
                    }
                }
            }
            return true;
        }
    </script>

    <table id="reportCondition">
        <tr>
            <td>
                <table>
                    <tr>
                        <td>起始时间</td>
                        <td>
                            <asp:TextBox ID="txtDateFrom" runat="server"  οnclick="new Calendar().show(this);"></asp:TextBox></td>
                        <td>截止时间:</td>
                        <td>  <asp:TextBox ID="txtDateTo" runat="server"  οnclick="new Calendar().show(this);"></asp:TextBox>
                        
                           </td>
                           <td>商户号:</td>
                        <td>  <asp:TextBox ID="txtMerchant" runat="server"></asp:TextBox>
                        
                           </td>
                    </tr>
                   
                    
                    <tr>
                        <td colspan="6"><asp:Button ID="btnSearch" runat="server" Text="查询"
                                οnclick="btnSearch_Click" /></td>
                    </tr>
                </table>
            </td>
        </tr>      
        <tr>
            <td id="ReportTD" valign="top">
                <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt"
                    SizeToReportContent="True" ProcessingMode="Remote" Width="100%" BackColor="#eaf6fc"
                    ShowFindControls="False" ToolTip="批量交易信息报表" ShowBackButton="true" ShowZoomControl="true"
                    AsyncRendering="False" ZoomMode="FullPage" ShowRefreshButton="true" Height="500px">
                </rsweb:ReportViewer>
            </td>
        </tr>
    </table>
</asp:Content>

2、cs

protected void Page_Load(object sender, EventArgs e)
        {
            
        }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            ReportViewer1.ProcessingMode = ProcessingMode.Remote;
            ServerReport serverReport = ReportViewer1.ServerReport;

            // Set the report server URL and report path

            string IpValue = ConfigurationManager.AppSettings["IpStr"].ToString();
            serverReport.ReportServerUrl = new Uri("http://" + IpValue + "/reportserver");
            serverReport.ReportPath = "/AhReports/TransferMoneyReport";
            List<ReportParameter> paras = new List<ReportParameter>();
            paras.Add(new ReportParameter("dateFrom", string.IsNullOrEmpty(txtDateFrom.Text.Trim()) ? string.Empty : txtDateFrom.Text.Trim()));
            paras.Add(new ReportParameter("dateTo", string.IsNullOrEmpty(txtDateTo.Text.Trim()) ? string.Empty : txtDateTo.Text.Trim()));
            paras.Add(new ReportParameter("merchantId", string.IsNullOrEmpty(txtMerchant.Text.Trim()) ? string.Empty : txtMerchant.Text.Trim()));

            serverReport.SetParameters(paras);
        }

3、母版页

<head id="Head" runat="server">
    <title>
        <asp:ContentPlaceHolder ID="TitleContent" runat="server" />
    </title>
        <script src="<%=VirtualPathUtility.ToAbsolute("~/Scripts/WebFormReportViewStyle.js") %>" type="text/javascript"></script>//去掉webForm 调用Reporting Service时,出现的两层滚动条
   

</head>

 

 

 

运行页面时,调整窗口适当大小,你最多会内外三层滚动条,如何去掉多余滚动条,参见调用 Reporting Service 时,怎么去掉滚动条

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值