レポート (rptCountByUnit) を表示するために使用している .aspx ページ (rvSuggestions) に ReportViewer コントロールがあります。レポートは、ストアド プロシージャ (dsCountByUnit.xsd の tableadapter) を使用してデータを取得するデータ ソース objdsCountByUnit を使用します。ストアド プロシージャは、パラメーター @fromDate (ページの txtFrom から渡される) および @toDate (ページの txtTo から渡される) を受け入れます。
dsCountByUnit.xsd を開いてデータをプレビューすると、期待どおりの結果が得られますが、ページを実行すると rvSuggestions が表示されません。DIV コンテナがそのまま下に展開されますが、空白が表示されます。
ポストバックはbtnSubmitによってトリガーされ、このリンクで説明されているように以下のコードを追加しましたが、問題は解決しません(奇妙なことに、私が取り組んでいる別のプロジェクトで問題を解決しました)
rvSuggestions.Visible = True
rvSuggestions.ProcessingMode = ProcessingMode.Remote
rvSuggestions.ProcessingMode = ProcessingMode.Local
rvSuggestions.LocalReport.Refresh()
これは私の ReportViewer とオブジェクト データ ソースです。
<rsweb:ReportViewer ID="rvSuggestions" runat="server" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Width="870px" AsyncRendering="False">
<LocalReport ReportPath="Reports\rptCountByUnit.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="objdsCountByUnit" Name="rptDataSet" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="objdsCountByUnit" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="dsCountByUnitTableAdapters.getCountOfSuggestionsByUnitTableAdapter">
<SelectParameters>
<asp:ControlParameter ControlID="txtFrom" Name="fromDate" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="txtTo" Name="toDate" PropertyName="Text" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
これは私のストアドプロシージャです:
CREATE PROCEDURE getCountOfSuggestionsByUnit
@fromDate nvarchar(50),
@toDate nvarchar(50)
AS
BEGIN
SET NOCOUNT ON;
SELECT unit, COUNT (ref) as Suggestions
FROM suggestion.dbo.suggestions
where dateRaised BETWEEN @fromDate and @toDate
group by unit
これを引き起こしている可能性のあるアイデアはありますか?