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

本文介绍如何在SQL Server Reporting Services (SSRS)中创建动态超链接,包括使用GotoURL属性设置固定网址及通过表达式生成动态网址的方法。此外还提供了解决表达式长度限制的方案,例如利用隐藏参数来构建长网址。

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'))"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值