Friday, March 30, 2012

ReportViewer does not show report in aspx page

I created a report with a parameter. The parameter was created using a dataset in the report designer. This works fine. I deployed the report (webhost4life) and the report runs fine in the report manager. I am able to select my casenumber click on the default view report button and it works.

Problem: I embedd the report into an aspx page frmReports1.aspx. I call this page from another page (form). the frmReports.aspx page comes up and displays the default drop down list box with the casenumbers (fine). I select the casenumber and click on the view report button and NOTHING. I here the postbacks taking place but all that happens is the default value appears in the drop down list box and the toolbar shows. I checked permissions and everything is fine. I searched the forum and thought i found the solution with the inLine HTML and Async (still nothing) I can only think that something is not going right with the parameter. Here is my html, and code behind code. any help would be greatly apprcieated.

Zachary

<%@. Page Language="VB" AutoEventWireup="false" CodeFile="frmReports1.aspx.vb" Inherits="frmReports1" %>

<%@. Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

<%@. Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Untitled Page</title>

<style>html,body,form {height:100%}</style>

</head>

<body>

<form id="form1" runat="server">

<div>

<rsweb:ReportViewer ID="rvTest" runat="server" Width="600px" ProcessingMode="Remote" AsyncRendering="false" Height="75%" >

<ServerReport

DisplayName="Billable Hours"

ReportPath="/sddmtech/SnowandIce/rptHoursWorked"

ReportServerUrl="http://sqlreport01.mysite4now.com/Reportserver" />

</rsweb:ReportViewer>

&nbsp;

</div>

</form>

</body>

</html>

aspx code behind

Imports System.Net

Imports System.Security.Principal

Imports Microsoft.Reporting.WebForms

Partial Class frmReports1

Inherits System.Web.UI.Page

Protected Sub rvTest_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles rvTest.Init

End Sub

<Serializable()> _

Public NotInheritable Class MyReportServerCredentials

Implements IReportServerCredentials

Public ReadOnly Property ImpersonationUser() As WindowsIdentity _

Implements IReportServerCredentials.ImpersonationUser

Get

Return Nothing

End Get

End Property

Public ReadOnly Property NetworkCredentials() As ICredentials _

Implements IReportServerCredentials.NetworkCredentials

Get

' Put your login and password here this works fine

Dim userName As String = ""

Dim password As String = ""

Dim domain As String = ""

Return New NetworkCredential(userName, password, domain)

'********************************************************************************

End Get

End Property

Public Function GetFormsCredentials(ByRef authCookie As System.Net.Cookie, ByRef userName As String, ByRef password As String, ByRef authority As String) As Boolean Implements Microsoft.Reporting.WebForms.IReportServerCredentials.GetFormsCredentials

End Function

End Class

Public Function GetFormsCredentials(ByRef authCookie As Cookie, _

ByRef userName As String, _

ByRef password As String, _

ByRef authority As String) _

As Boolean

authCookie = Nothing

userName = Nothing

password = Nothing

authority = Nothing

'Not using form credentials

Return False

End Function

Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load

'ReportViewer1.ServerReport.ReportServerCredentials = New MyReportServerCredentials()

'rvTest.ServerReport.Refresh()

End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

rvTest.ServerReport.ReportServerCredentials = New MyReportServerCredentials()

End Sub

End Class

Try taking out the http://www.w3.org/1999/xhtml namespace value and see if it works. It may have nothing to do with it, but there are some um infelicities with the rendered HTML for report viewer that make the Standards Police very unhappy...

It's just a guess but it is a guess that will take you 3 seconds to check <s>.

I don't think it's your credentials -- otherwise why would the parameters etc show up? You're getting to the site...

>L<

|||

Thanks Lisa

I took the www.w3.org statement out but it did not work. Still the same.

Zachary

|||

Hi Lisa

It is a problem with the parameter. I created a stored procedure with the same data however; it does not contain a parmeter. i.e. it pulls back all of the data (it works).

In report designer I created two datasets. One dataset holds all the possible values that can be passed to the stored procedure

Select CaseNumber from tblCases

These values are put into a drop down list box in the toolbar (it is done automatically for me).

The second dataset uses this value once it is selected and retrieves the data that is to be displayed in the report. (This is the disconnect. ) Does anyone know how to do this. I do not want to create a custom control in the toolbar. I want to extract the parameter value that already exists in the existing toolbar and then pass that value to the stored procedure / report.

Is there an example or does anyone have an example of passing the parameter value using the Report Viewer and a stored procedure.

thanks

Zachary

|||>.

Is there an example or does anyone have an example of passing the parameter value using the Report Viewer and a stored procedure.

<

Yep <g>.

http://forums.microsoft.com/msdn/showpost.aspx?postid=1705421&siteid=1&sb=0&d=1&at=7&ft=11&tf=0&pageid=1

>L<

|||

Thanks Lisa

Fixed the problem - In Problem I was reloading the report on postback therefore cancelling out the paramter. So I did a check for post back (i.e if page.ispostback = false then ) and everything is working.

This is a greate forum.

Zachary

Fixed the problem - thanks

Zachary

|||

Cool! Thanks for explaining.

>L<

No comments:

Post a Comment