简体   繁体   English

强制SSRS报表中的链接从Silverlight中在新窗口中打开

[英]Forcing links in an SSRS report to open in a new window from within silverlight

I have an SSRS report embedded within a silverlight application and I want the links in that report to open in a new tab . 我在Silverlight应用程序中嵌入了SSRS报告,并且希望该报告中的链接在新选项卡中打开。

I already tried the below and they both didn't work : 我已经尝试了以下方法,但它们都没有起作用:

  • making the link javascript:void(window.open(' http://wwww.google.com ')) (It just doesn't execute javascript from within silverlight but when I preview the report in Visual Studio it works) 制作链接javascript:void(window.open(' http://wwww.google.com '))(它只是不从silverlight中执行javascript,但是当我在Visual Studio中预览报表时,它可以工作) 在此处输入图片说明
  • adding target='_blank' in the href tag 在href标记中添加target ='_ blank' 在此处输入图片说明
  • Adding this parameter at the end &rc:LinkTarget=_blank (It opens in the same window) 在&rc:LinkTarget = _blank的末尾添加此参数(在同一窗口中打开)

Any help is appreciated 任何帮助表示赞赏

This should solve in Code behind 这应该在代码后面解决

 System.Windows.Browser.HtmlPage.Window.Navigate(
   new Uri("http://silverlight.net"),
   "_blank", "height=300,width=600,top=100,left=100");

Src: MSDN Src:MSDN

OR 要么

Don't use href="javascript:void" 不要使用href =“ javascript:void”

It means people without javascript cannot use the link. 这意味着没有javascript的人无法使用该链接。 Use something like this instead. 使用类似这样的东西。

Then add this to the head of your page 然后将其添加到页面的顶部

<script>
function myFunction() {
window.open("http://www.w3schools.com");
}
 </script>
  <body>
 <a href="#" onclick="myFunction()">click here</a>
 </body>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM