Showing posts with label reportviewer. Show all posts
Showing posts with label reportviewer. Show all posts

Friday, March 30, 2012

Problems with the Web ReportViewer Control

Problems with the Web ReportViewer Control

I'm using SQL Server 2005 Reporting Services Sept CTP and Visual Studio 2005 RC to develop an ASP.NET application. On one of my web forms I have placed the web ReportViewer control so that I can display reports from Reporting Services.

The .aspx code is:

<%@. Page Language="C#" AutoEventWireup="true" CodeFile="ReportViewer.aspx.cs" Inherits="ReportViewer" %>

<%@. Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

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

<head runat="server">

<title>ReportViewer</title>

</head>

<body>

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

<div>

<asp:Panel ID="PanelDisplayReport" runat="server" Height="100%" Width="100%">

<rsweb:reportviewer id="ReportViewerDisplayReport" runat="server" bordercolor="Navy" borderstyle="Solid" borderwidth="1px" height="100%" tooltip="Display Report" width="100%" Font-Names="Verdana" Font-Size="8pt" ProcessingMode="Remote">

</rsweb:reportviewer>

</asp:Panel>

</div>

</form>

</body>

</html>

The .aspx code-behind (in C#) is:

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

public partial class ReportViewer : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

this.ReportViewerDisplayReport.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;

this.ReportViewerDisplayReport.ToolTip = "/AdventureWorks Sample Reports/Company Sales";

this.ReportViewerDisplayReport.ZoomPercent = 90;

this.ReportViewerDisplayReport.ServerReport.DisplayName = "/AdventureWorks Sample Reports/Company Sales";

this.ReportViewerDisplayReport.ServerReport.ReportPath = @."/AdventureWorks Sample Reports/Company Sales";

this.ReportViewerDisplayReport.ServerReport.ReportServerUrl = new Uri(@."http://localhost/ReportServer");

}

}

As you can see, this is a very simply web form that is simply trying to display one of the reports from the AdventureWorks sample database and reports.

The problem is that the report will not display in the ReportViewer control. When I request the page, I see the ReportViewer's toolbar but not the actual report. I initially see the "Report is being generated" message in the control, where the report would normally be displayed. But, after the report is generated, no report, just the toolbar.

Anyway, does any one have any suggestions as to what's wrong?

Is there a bug in the ReportViewer control (for web forms) in Visual Studio 2005 RC?

Anything else???

Thanks in advance.


The problem is that height is set to 100% and doctype is set to XHTML. Either set the height to a fixed size (not a percent) or remove the line that sets doctype to XHTML.|||Thanks for this. I spent a couple of hours on this, I could have spent many more.|||You can also fix this problem by rendering the report synchronously. The control displays the report differently based on the method of rendering and calculates the actual height on the fly. When rendered synchronously, the calculated height is 0px, so nothing shows.

Problems with the ReportViewer Control

Theclient side reportviewer control is used with a typed dataset in vs 2005.

But I have noticed something that is really interesting,

theturkish characters in the dataset are changed in the runtime enviroment when used with the reportviever control.

such as.

exec sp_executesql N'SELECT CASES._ID, CASES._OWNERID, CASES._LASTMODIFYDATE, CASES._DELETIONSTATUS, CASES._SECURITYCODE,
CASES._NAME, CASES._STATE,
CASES._DESCRIPTION, CASES._CATEGORY, CASES._TYPE, CASES.PRIORITY, CASES.REASON, CASES.ORIGIN, CASES.FROMDATE,
CASES.TODATE,
CASES.COMMENT, CASES.WHATID, CASES.WHATTYPE, VIEW_WHONAME.WHONAME, ORGANIZATION._NAME AS ORGANIZATIONNAME,
PERSON.HOMETEL, PERSON.EMAIL
FROM CASES INNER JOIN
VIEW_WHONAME ON CASES.WHOID = VIEW_WHONAME.WHOID INNER JOIN
PERSON ON VIEW_WHONAME.WHOID = PERSON._ID INNER JOIN
ORGANIZATION ON PERSON.WORKINGORGANIZATIONID = ORGANIZATION._ID
WHERE (CASES._OWNERID = @.ownerID) AND (CASES._ID = @.entityID) AND (VIEW_WHONAME.WHOTYPE =''KİÅ?İ'')',N'@.ownerID
smallint,@.entityID int',@.ownerID=1,@.entityID=30

-----------

>>> the bold area should be 'K???' which is a turkish string...

What sholud I do? Do I need to configure the sql server or do I need to configure asp.net runtime?

Is the data type of VIEW_WHONAME.WHOTYPE NVARCHAR? If yes, that means you've stored the unicode characters in SQL, so just make sure you're comparing it to unicode chars at runtime. You can mark a string as UNICODE in SQL by adding a N prefix in front of the string:

VIEW_WHONAME.WHOTYPE =N''KİÅ?İ''

|||

I did tried that but still the dataset in the app_code changes the string at runtime.When I test the dataset designer at design time, everything is just fine.

if there any configuration I have to make to stop asp.net runtime changing my strings?

----------------------------

exec sp_executesql N'SELECT CASES._ID, CASES._OWNERID, CASES._LASTMODIFYDATE, CASES._DELETIONSTATUS, CASES._SECURITYCODE,
CASES._NAME, CASES._STATE,
CASES._DESCRIPTION, CASES._CATEGORY, CASES._TYPE, CASES.PRIORITY, CASES.REASON, CASES.ORIGIN,
CASES.FROMDATE, CASES.TODATE,
CASES.COMMENT, CASES.WHATID, CASES.WHATTYPE, VIEW_WHONAME.WHONAME, ORGANIZATION._NAME AS ORGANIZATIONNAME,
PERSON.HOMETEL, PERSON.EMAIL
FROM CASES INNER JOIN
VIEW_WHONAME ON CASES.WHOID = VIEW_WHONAME.WHOID INNER JOIN
PERSON ON VIEW_WHONAME.WHOID = PERSON._ID INNER JOIN
ORGANIZATION ON PERSON.WORKINGORGANIZATIONID = ORGANIZATION._ID
WHERE (CASES._OWNERID = @.ownerID) AND (CASES._ID = @.entityID) AND (VIEW_WHONAME.WHOTYPE =N''KİÅ?İ'')',N'@.ownerID
smallint,@.entityID int',@.ownerID=1,@.entityID=30

|||finally I have sp?ved the problem by jsut saving the dataset using advanced save options and I gave the apporopiate encoding to it.|||finally I have solved the problem by just saving the dataset using advanced save options and I gave the apporopiate encoding to it.

Friday, March 23, 2012

problems with ReportViewer Control: Not accepting parameters

Hello all,
I am trying to use the reportviewer control to publish reports in
another website to provide customised interface.
I am using the example at
http://www.odetocode.com/Articles/128.aspx to try to make it work.
It works fine normal. I get a frame of params and after Submitting i
get the report in another frame.
When I try to hide the paramters frame and send parameters through the
Reportpath property I get the following errors.
When I set a param a value this is the error I get:
An attempt was made to set a report parameter 'param_IdServer' that is
not defined in this report. (rsUnknownReportParameter) Get Online Help
When I dont pass any params but still have the command
rc:Parameters=false& in the URL i get the follow error.
The path of the item '/projectname/reportname,' is not valid. The full
path must be less than 260 characters long, must start with slash;
other restrictions apply. Check the documentation for complete set of
restrictions. (rsInvalidItemPath) Get Online Help
I would like to know where is the problem.
Thanks
RaviI'm also trying to use the ReportViewer control, to some success.
Assuming you are passing parameters through code, you can use the
SetQueryParameter(), which is the same as the Ode To Code example.
Remember, if it is not a report parameter, always include the prefix (i.e.
rc, rs). Without these prefixes, the parameters are treated as report
parameters and you get the rsUnknownReportParameter error.
SetParameter("rc:Parameters","false");
SetParameter("rc:DocMap","false");
SetParameter("rc:LinkTarget","_top");
The rsInvalidItemPath error is usually due to some invalid characters on the
URL string. Try removing the "amp;" on your url.
Hope this helps.
Marlon
"RemoteDeploy" <bofobofo@.yahoo.com> wrote in message
news:1108516396.906611.247880@.f14g2000cwb.googlegroups.com...
> Hello all,
> I am trying to use the reportviewer control to publish reports in
> another website to provide customised interface.
> I am using the example at
> http://www.odetocode.com/Articles/128.aspx to try to make it work.
> It works fine normal. I get a frame of params and after Submitting i
> get the report in another frame.
> When I try to hide the paramters frame and send parameters through the
> Reportpath property I get the following errors.
> When I set a param a value this is the error I get:
> An attempt was made to set a report parameter 'param_IdServer' that is
> not defined in this report. (rsUnknownReportParameter) Get Online Help
> When I dont pass any params but still have the command
> rc:Parameters=false& in the URL i get the follow error.
> The path of the item '/projectname/reportname,' is not valid. The full
> path must be less than 260 characters long, must start with slash;
> other restrictions apply. Check the documentation for complete set of
> restrictions. (rsInvalidItemPath) Get Online Help
> I would like to know where is the problem.
> Thanks
> Ravi
>|||I am back to square one. The customer doesnt want the web service
interface as well. After comparing the pros and cons he wants the
Reportviewer Control.
Here is how its supposed to look.
A frame based page.
Left Frame --> a treeview or a menu like listing of all the reports
Right Frame --> when the user clicks a report I should render the
Reportviewer object for that report.
Now I have some questions of the Reportviewer as well.
1. Can I seperate the params part and the report part into 2 diff
frames ?
Thx
Ravi|||You might find these examples helpful.
http://msdn.microsoft.com/msdnmag/issues/04/08/SQLServerReportingServices/default.aspx
http://odetocode.com/Articles/95.aspx
Marlon
"RemoteDeploy" <bofobofo@.yahoo.com> wrote in message
news:1108750314.788207.212850@.g14g2000cwa.googlegroups.com...
>I am back to square one. The customer doesnt want the web service
> interface as well. After comparing the pros and cons he wants the
> Reportviewer Control.
> Here is how its supposed to look.
> A frame based page.
> Left Frame --> a treeview or a menu like listing of all the reports
> Right Frame --> when the user clicks a report I should render the
> Reportviewer object for that report.
> Now I have some questions of the Reportviewer as well.
> 1. Can I seperate the params part and the report part into 2 diff
> frames ?
> Thx
> Ravi
>|||hey TechnoSpyke,
thanks for the links. They helped me a lot.
Ravi

Friday, March 9, 2012

problems with Exporting and Viewer

Hi, i'm having troubles using the ReportViewer to export to a pdf. Parameters are set by the user and (depending on the report) programmatically.
When i try to export in my code, i get a "Missing Parameter Values" error.
However, if i try to open a report with no parameters - the export works fine.

Can someone please help me out?

Here's my code:

this is the Export code:

<code>
private void Export4()
{
string ExportPath;
ExportPath = Request.PhysicalApplicationPath + "Exported\\";

if (Directory.Exists(ExportPath) == false)
Directory.CreateDirectory(Request.PhysicalApplicationPath + "Exported\\");

crDiskFileDestinationOptions = new DiskFileDestinationOptions();
crExportOptions = reportDocument1.ExportOptions;
crDiskFileDestinationOptions.DiskFileName =ExportPath + "PortableDoc.pdf";
crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;

try
{
reportDocument1.Export();
}
catch (Exception err)
{
Response.Write("<BR>");
Response.Write(err.Message.ToString());
}
}
</code>

And this is the code that sets the parameters, report and Viewer:

<code>

public void LoadReport_Param(ref CrystalReportViewer crViewer, ref ReportDocument crReport)
{
TableLogOnInfo crTableLogOnInfo = new TableLogOnInfo();
ConnectionInfo crConnInfo = new ConnectionInfo();
CrystalDecisions.CrystalReports.Engine.Database crDatabase;
CrystalDecisions.CrystalReports.Engine.Tables crTables;
ParameterDiscreteValue crPDValue;
ParameterFieldDefinitions crPFDefs;
ParameterFieldDefinition crPFDef;
ParameterValues crPValues;
try
{
crConnInfo.ServerName = _servername;
crConnInfo.DatabaseName = _dbname;
crConnInfo.UserID = _username;
crConnInfo.Password = _password;
crDatabase = crReport.Database;
crTables = crDatabase.Tables;

foreach(CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
{
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
}
crPFDefs = crReport.DataDefinition.ParameterFields;
for (int intParamCounter = 0; intParamCounter <= crPFDefs.Count-1; intParamCounter++)
{
try
{
crPFDef = crPFDefs[intParamCounter];
crPValues = crPFDef.CurrentValues;
if ((_GroupABBR != "") || (crPFDef.ParameterFieldName == "Branch") ||
(crPFDef.ParameterFieldName == "@.Branch")|| (crPFDef.ParameterFieldName == "?Branch") || (crPFDef.ParameterFieldName.ToLower() == "branch"))
{
crPDValue = null;
crPDValue = new ParameterDiscreteValue();
crPDValue.Value = _GroupABBR;
crPValues.Add(crPDValue); crPFDef.ApplyCurrentValues(crPValues);
}
}

catch (EngineException engEx)
{
throw new Exception(engEx.Message);
}
}
crViewer.ReportSource= crReport;
}
catch (LogOnException engEx)
{
throw new Exception("Incorrect Logon Parameters. Check your user name and password.");
}
catch (DataSourceException engEx)
{ throw new Exception("An error has occurred while connecting to the database.");
}
catch (EngineException engEx)
{
throw new Exception(engEx.Message);
}
}
</code>Did you ever get a result with this? I am having the same problem. I have watched every single ParameterField in my ParameterFields collection and where there isnt a value, I set one - then as soon as I do ReportDocument.Export I get this "Missing Parameter Values" exception.|||See if you are able to find solution here
www.businessobjects.com