Wednesday, March 28, 2012

ReportViewer and Click through links

I am creating a .Net application using the ReportViewer, which is working fine.
But when I have a report that has a link to another report, upon clicking
the link it takes the new report to full screen.
What I want to happen is for the new report stay in the ReportViewer.
Any ideas?
--
Regards
<<<Bryan Avery>>Ok I just did this and it was kind of a pain. Too me all day to work it out.
1. You need to use 'Jump to URL' instead of the other options.
2. Open Report Viewer project and add the following code:
Private _linktarget As String = "_self"
<Category("HTMLViewer Commands"), Description("Sets rc:linktarget to change
iFrame target")> _
Public Property LinkTarget() As String
Get
Return Me._linktarget
End Get
Set(ByVal Value As String)
Me._linktarget = Value
Me.SetParameter("rc:LinkTarget", Value)
End Set
End Property
3. Recompile and place dll in project bin.
Now the default is _self and you have the option to change the target from
your code.
This solution isn't ideal because you have to use the jump to url which
means more work in creating the url with params, and you may have to hard
code your servername.
--
Message posted via http://www.sqlmonster.com|||Hi Patrick,
Thanks for the quick response, but I'm a little lost to where I should be
entering line 2, could you give me any more pointers please?
--
Regards
<<<Bryan Avery>>
"Patrick P via SQLMonster.com" wrote:
> Ok I just did this and it was kind of a pain. Too me all day to work it out.
> 1. You need to use 'Jump to URL' instead of the other options.
> 2. Open Report Viewer project and add the following code:
> Private _linktarget As String = "_self"
> <Category("HTMLViewer Commands"), Description("Sets rc:linktarget to change
> iFrame target")> _
> Public Property LinkTarget() As String
> Get
> Return Me._linktarget
> End Get
> Set(ByVal Value As String)
> Me._linktarget = Value
> Me.SetParameter("rc:LinkTarget", Value)
> End Set
> End Property
> 3. Recompile and place dll in project bin.
> Now the default is _self and you have the option to change the target from
> your code.
> This solution isn't ideal because you have to use the jump to url which
> means more work in creating the url with params, and you may have to hard
> code your servername.
> --
> Message posted via http://www.sqlmonster.com
>|||No problem. There are a few changes I discovered since the last post, I'll
note them the end here.
You can find the reportviewer project here:
C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\Samples\
Applications\ReportViewer\vb
Open the project and open the ReportViewer.vb class file.
in the "Private Member Variables" region add:
Private _linktarget As String = "_self"
in the "Properties" region add the property in the above thread.
Now here is the addition to the above.
in the "Render" region add the following line to the Render sub:
output.WriteAttribute("name", "ifmReport")
You need this when you call the viewer property you created. Compile and
drop in your bin/GAC.
So now in your app you will add the following line:
rvwReport.LinkTarget = "ifmReport"
rvwReport being your declared instance of the object. In this bit of code:
Protected WithEvents rvwReport As
Microsoft.Samples.ReportingServices.ReportViewer
Now the good news is that I discovered that the "Jump to Report" option
works when I do this, which is great because the "Jump to URL" was a real
pain.
I'm assuming you are a VB and not a C# person.
Hope this helps... now I'm off to post more questions.
--
Message posted via http://www.sqlmonster.com|||Good news is that it is working :-)
Bad news is, it is only working in part.
What I mean is that you can display the first report, and a click to the
next report works okay, but on the third click to the third report it goes
back to full screen :-(
--
Regards
<<<Bryan Avery>>
"Patrick P via SQLMonster.com" wrote:
> No problem. There are a few changes I discovered since the last post, I'll
> note them the end here.
> You can find the reportviewer project here:
> C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\Samples\
> Applications\ReportViewer\vb
> Open the project and open the ReportViewer.vb class file.
> in the "Private Member Variables" region add:
> Private _linktarget As String = "_self"
> in the "Properties" region add the property in the above thread.
> Now here is the addition to the above.
> in the "Render" region add the following line to the Render sub:
> output.WriteAttribute("name", "ifmReport")
> You need this when you call the viewer property you created. Compile and
> drop in your bin/GAC.
> So now in your app you will add the following line:
> rvwReport.LinkTarget = "ifmReport"
> rvwReport being your declared instance of the object. In this bit of code:
> Protected WithEvents rvwReport As
> Microsoft.Samples.ReportingServices.ReportViewer
> Now the good news is that I discovered that the "Jump to Report" option
> works when I do this, which is great because the "Jump to URL" was a real
> pain.
> I'm assuming you are a VB and not a C# person.
> Hope this helps... now I'm off to post more questions.
> --
> Message posted via http://www.sqlmonster.com
>|||I know, I'm trying to work that out now. So annoying, thought I had it solved.
Seems that when the report goes back to the server it "forgets" the target
and goes back to "_top". :-\ There has to be a config setting on the server
that we can change. So can anyone out there find it?
--
Message posted via http://www.sqlmonster.com|||Thanks for all your effort.
I was wondering if you know how we can control the tool bar that is within
the ReportViewer so we can have external controls controlling the Zoom,
Export, etc.
Is this something you've come across and is it easy to do?
--
Regards
<<<Bryan Avery>>
"Patrick P via SQLMonster.com" wrote:
> I know, I'm trying to work that out now. So annoying, thought I had it solved.
> Seems that when the report goes back to the server it "forgets" the target
> and goes back to "_top". :-\ There has to be a config setting on the server
> that we can change. So can anyone out there find it?
> --
> Message posted via http://www.sqlmonster.com
>

No comments:

Post a Comment