3

SSRS用のReportViewerコントロールのASP.NETバージョンに問題があります。

ASP.NET Webフォームファイルには、次のものがあります。

    <rsweb:ReportViewer ID="webViewer" runat="server" Width="100%" Height="100%" 
        ProcessingMode="Remote">
        <ServerReport ReportPath="/AnalyticReports/SiteOverview" 
            ReportServerUrl="http://someserver/ssrs" />
    </rsweb:ReportViewer>

これは期待どおりに正常に機能し、ダンディです。

ただし、サーバーとレポートパスをプログラムで変更したいとします。どうすればいいですか?

私はこれを試しました:

webViewer.ServerReport.ReportServerUrl = new Uri("http://someserver/ssrs");
webViewer.ServerReport.ReportPath = "/AnalyticReports/SiteOverview";
webViewer.ServerReport.Refresh();

しかし、それは何もしないようです。webViewer.Reset()を追加しようとしましたが、役に立ちませんでした。

誰かが私を正しい方向に向けますか?

4

4 に答える 4

2

実は、問題はPage_Loadイベントにあるようです。http://msdn.microsoft.com/en-us/library/aa337091.aspxに出くわした後、試しPage_Initてみましたが、期待どおりに機能しているようです。

于 2012-08-21T09:15:53.413 に答える
2

値を取得して設定するプロパティを使用してこれを行いました

public string ReportPathString 
{ get { return ReportViewer1.ServerReport.ReportPath; } 
  set { ReportViewer1.ServerReport.ReportPath = value; } 
}

public string ReportServerUrlString 
{ get { return ReportViewer1.ServerReport.ReportServerUrl.ToString(); } 
  set { ReportViewer1.ServerReport.ReportServerUrl = new Uri(value); } 
}

また、page_loadにいる間、クレデンシャルを設定するために次のコードを使用します

IReportServerCredentials irsc = new ReportServerCredentials("Username", "Password", "Domain");

以下のように使用されているクラス

public class ReportServerCredentials : IReportServerCredentials
{
private string _UserName;
private string _PassWord;
private string _DomainName;

public ReportServerCredentials(string UserName, string PassWord, string DomainName)
{
    _UserName = UserName;
    _PassWord = PassWord;
    _DomainName = DomainName;
}

public System.Security.Principal.WindowsIdentity ImpersonationUser
{
    // use default identity
    get { return null; }
}

public ICredentials NetworkCredentials
{
    // use default identity
    get { return new NetworkCredential(_UserName, _PassWord, _DomainName); }
}

public bool GetFormsCredentials(out Cookie authCookie, out string user,
 out string password, out string authority)
{
    authCookie = null;
    user = password = authority = null;
    return false;
}


}

編集:トピックが1歳であるのを見たばかりです...

于 2013-09-19T07:58:22.417 に答える
0

ロイド、これを試しましたか?

webViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
于 2012-08-20T15:48:09.747 に答える
0

私はLocalReportを使用していますが、これはうまく機能しているようです。

var reportDataSource = new ReportDataSource("DataSet1", resultSet);

ReportViewer1.LocalReport.ReportPath = Server.MapPath("/Reports/" + reportName + ".rdl");
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(reportDataSource);

ReportViewer1.LocalReport.Refresh();
于 2012-08-20T17:19:24.077 に答える