当前位置: 代码迷 >> 报表 >> 在表格中新建窗口打开超链接
  详细解决方案

在表格中新建窗口打开超链接

热度:225   发布时间:2016-05-05 08:01:25.0
在报表中新建窗口打开超链接

Navigating to other reports or any web URL
- Drag a datafield on the report
- Click on the Textbox
- Find the Action property of Textbox the property window
- Select Go to URL option
- Type any valid URL (i.e. http://binaryworld.net/Main/CodeDetail.aspx?CodeId=3668), valid URL must start with protocol like http: ,ftp:, mailto: ...

Opening Link in a new window

Well this is very common requirement but unfortunately there is no direct option available in Reporting Services Designer. You can do that using the following technique
Use the following expression in the "Go to URL"

="javascript:void(window.open('http://binaryworld.net/Main/CodeDetail.aspx?CodeId=3668','_blank'))"

How to overcome expression length limitation (Dynamicly generate hyperlink)
Another limitation of "Go to URL" field is you are limited to Maximum expression characters. You can solve this problem by using "Dummy parameters". You can create parameters for report without any prompt string and then specify default value which will act as a constant for your report.
For example if I have a really long URL which is not allowed in the "Go to URL" expression then I can create a new report parameter called CW_URL. Set your long URL as default value for this parameter. Now remove any prompt string for this parameter so it wont appear when you run your report.
default value for cw_url => http://binaryworld.net/Main/CodeDetail.aspx?CodeId=
Now you can type the following expression in "Go to URL" to get dynamic URL based on Database field called CodeID and static URL from cw_url hidden parameter.

="javascript:void(window.open('" & Parameters!cw_url.Value & Fields!CodeId.value & "','_blank'))"
  相关解决方案