How to set hyperlink in rdlc for both localhost and server?
I am using rdlc reporting to display report, in rdlc report I was set hyperlink 开发者_运维百科for another report like:
="http://localhost:8080/ReportForms/RECRptAdvertisement.aspx?
reqid="&Fields!RequirementID.Value
From above URL my hyperlink working fine in localhost but if I change it to this:
="~/RECRptAdvertisement.aspx?reqid="&Fields!RequirementID.Value
It is not working. So how do I set my hyperlink url to be workable in localhost as well as in server.
You need to pass the Server Url to the report as a Parameter, then your expression for the textbox should reference that local report parameter.
Add a new Parameter to your report and set it to =Parameters!ReportParameterUrl.Value
When Loading the ReportViewer, set the correct url:
baseUrl = Request.Url.Scheme + @"://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + '/';
ReportParameter rp = new ReportParameter("ReportParameterUrl", baseUrl);
this.rvMyReport.LocalReport.SetParameters(new ReportParameter[] { rp });
Finally, your text box expressions should be
=Parameters!ReportParameterUrl.Value + "RECRptAdvertisement.aspx?reqid="&Fields!RequirementID.Value
Have you tried to pass a value to the URL manually to see if it behaves the sameway on localhost URL and named instance? what about trying via IP as well?
something like...
="~/RECRptAdvertisement.aspx?reqid=20001298"
精彩评论