C# と VB.NET の質問掲示板

わんくま同盟

ASP.NET、C++/CLI、Java 何でもどうぞ

C# と VB.NET の入門サイト

■102631 / 3階層)  Asp.net webFormでCrystalReportが
□投稿者/ WebSurfer (2818回)-(2023/11/28(Tue) 16:11:48)
No102630 (由美です さん) に返信

> BWebForm1にReportViewerとreportsourceを追加します
>  → 1,WebForm1にReportViewerを追加します
>       2,追加したReportViewerのレポートソースにreportsourceをセットします
>    3,reportsourceのレポートは新規作成で空のクリスタルレポートファイルを作成します 

サードパーティ製品ですか? 

reportsource というのは聞いたことがないのでググってみたら以下の記事がヒットしたのですが・・・

Setting ReportSource to Report Viewers Overview
https://docs.telerik.com/reporting/embedding-reports/display-reports-in-applications/how-to-set-reportsource-for-report-viewers

自分の環境 Windows 10, Visual Studio 2019 v16.11.32 (ワークロードに「データの保存と処理」), 
ReportViewer v15.0.0.0 (NuGet からインストール), Visual Studio 用 Microsoft RDLC レポートデ
ザイナー v15.3.1 (拡張機能) で ReportViewer をツールボックスからドラッグ&ドロップして作る
と以下のようになります。

それに、reportsource とかは必要ないし、CR:CrystalReportViewer というのも出てきません。

<%@ Page Language="C#" AutoEventWireup="true" 
    CodeBehind="ReportViewer.aspx.cs" 
    Inherits="WebApplication1.ReportViewer" %>

<%--ツールボックスから ReportViewer をドラッグ&ドロップすると自動的に追加される。--%>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <style type="text/css">
        #div1 {
            height: 500px;
            /*width: 800px;*/
        }

        a {
            text-decoration: none !important;
            color: #5C80B1 !important;
        }

        a:hover {
            text-decoration:underline !important;
        }
    </style>
    <script src="Scripts/jquery-3.4.1.js"></script>
    <script type="text/javascript">
        //<![CDATA[

        // ツールバーに全項目を表示するための対応を考えたのが下記

        window.onload = function () {
            // 最初の一行だけ表示の状態から、ツールバーをクリックすると
            // Expand するのがよさそう。スクロールバーを操作すると元に
            // 戻ってしまうが、その場合は再度クリックして表示する
            $("div.ToolBarButtonsCell").on('click', changecss);
        };

        function changecss() {
            $("div.ToolBarButtonsCell > div").each(function () {
                var display = $(this).css("display");
                if (display == "none") {
                    $(this).css("display", "inline-block");
                }
            });
        };
        //]]>
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

        <%--ReportViewer コントロールで 100% の高さを設定する方法
        https://docs.microsoft.com/ja-jp/sql/reporting-services/application-integration/integrating-reporting-services-using-reportviewer-controls-get-started?view=sql-server-2017#how-to-set-100-height-on-the-report-viewer-control--%>
        <div id="div1">
            <%--ツールボックスからドラッグ&ドロップ段階では
                <rsweb:ReportViewer ID="ReportViewer1" runat="server"></rsweb:ReportViewer>
                だけだが、デザイナで .rdlc ファイルを選択すると以下のように属性が自動的に追加される
                それに width="100%" height="100%" を追加--%>
            <rsweb:ReportViewer ID="ReportViewer1" runat="server" 
                BackColor="" ClientIDMode="AutoID" HighlightBackgroundColor="" InternalBorderColor="204, 204, 204" 
                InternalBorderStyle="Solid" InternalBorderWidth="1px" LinkActiveColor="" LinkActiveHoverColor="" 
                LinkDisabledColor="" PrimaryButtonBackgroundColor="" PrimaryButtonForegroundColor="" 
                PrimaryButtonHoverBackgroundColor="" PrimaryButtonHoverForegroundColor="" 
                SecondaryButtonBackgroundColor="" SecondaryButtonForegroundColor="" 
                SecondaryButtonHoverBackgroundColor="" SecondaryButtonHoverForegroundColor="" 
                SplitterBackColor="" ToolbarDividerColor="" ToolbarForegroundColor="" 
                ToolbarForegroundDisabledColor="" ToolbarHoverBackgroundColor="" ToolbarHoverForegroundColor="" 
                ToolBarItemBorderColor="" ToolBarItemBorderStyle="Solid" ToolBarItemBorderWidth="1px" 
                ToolBarItemHoverBackColor="" ToolBarItemPressedBorderColor="51, 102, 153" 
                ToolBarItemPressedBorderStyle="Solid" ToolBarItemPressedBorderWidth="1px" 
                ToolBarItemPressedHoverBackColor="153, 187, 226"
                height="100%" width="100%">
                <LocalReport ReportPath="Report1.rdlc" EnableHyperlinks="True">
                    <DataSources>
                        <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
                    </DataSources>
                </LocalReport>
            </rsweb:ReportViewer>
            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetData" TypeName="WebApplication1.NorthwindTableAdapters.ProductsTableAdapter"></asp:ObjectDataSource>
        </div>
        
    </form>
</body>
</html>

編集キー/

前の記事(元になった記事) 次の記事(この記事の返信)
←Re[2]: Asp.net webFormでCrystalReportが /由美です →Re[4]: Asp.net webFormでCrystalReportが /由美です
 
上記関連ツリー

Asp.net webFormでCrystalReportが / 由美です (23/11/28(Tue) 09:47) #102628
Re[1]: Asp.net webFormでCrystalReportが / WebSurfer (23/11/28(Tue) 12:04) #102629
│└ Re[2]: Asp.net webFormでCrystalReportが / 由美です (23/11/28(Tue) 14:53) #102630
│  └ Asp.net webFormでCrystalReportが / WebSurfer (23/11/28(Tue) 16:11) #102631 ←Now
│    └ Re[4]: Asp.net webFormでCrystalReportが / 由美です (23/11/29(Wed) 10:02) #102636
│      └ Re[5]: Asp.net webFormでCrystalReportが / WebSurfer (23/11/29(Wed) 11:22) #102637
│        └ Re[6]: Asp.net webFormでCrystalReportが / 由美です (23/11/29(Wed) 12:58) #102639
│          └ Re[7]: Asp.net webFormでCrystalReportが / WebSurfer (23/11/29(Wed) 14:05) #102640
Re[1]: Asp.net webFormでCrystalReportが / kiku (23/11/28(Tue) 17:13) #102632
  └ Re[2]: Asp.net webFormでCrystalReportが / 由美です (23/11/29(Wed) 09:55) #102635
    └ Re[3]: Asp.net webFormでCrystalReportが / kiku (23/11/29(Wed) 11:27) #102638

上記ツリーを一括表示 / 上記ツリーをトピック表示
 
上記の記事へ返信