推荐文章:
(http://www.cnblogs.com/linyechengwei/archive/2011/02/24/1963874.html)
2.在ReportViewer中使用超链接(HyperLink)
(http://www.cnblogs.com/belaliu/archive/2006/10/11/526521.aspx)
1.将EnableHyperlinks=true (超链接)
ReportViewer1.LocalReport.EnableHyperlinks = true;
2.将HyperlinkTarget="_blank"(默认的是 _top)改为HyperlinkTarget="_self"//解决火狐下兼容问题
<pre name="code" class="csharp">ReportViewer1.LocalReport.HyperlinkTarget="_blank"</pre>
3. 获取绝对路径
string req_url = this.Request.Url.ToString();<br>
int pos = req_url.IndexOf("/Web");//根据不同的情况找字符位置<br>
string current_virtual_path = "";<br>
if (pos > 0) <br>
{ <br>
current_virtual_path = req_url.Substring(0, pos + 5);//根据不同的情况截取字符串<br>
} <br>
4.将截取的的字符(发布之后端口有所不同)作为参数传入报表中 <br>
ReportParameter p1 = new ReportParameter("ParURL", current_virtual_path);<br>
ReportParameter p2 = new ReportParameter("ParCreateDate", missexstart + "~" + missexend);<br>
this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2 });<br>
5.在报表中的所钻取的参数设置Parameters!ParURL.Value 是所截取传入的参数(传入参数名称必须与在报表中设置参数的名一致,区分大小写)
<br>表达式设置:<br>
=Parameters!ParURL.Value+"ModalDialog/OA_MissionReportList.aspx?type=OA_MissionReport&EmpName="+Fields!EmpName.Value<br>
+"&CreateDate="+Parameters!ParCreateDate.Value
<pre></pre>