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

Wednesday, March 28, 2012

Resizing margins programmatically?

Hello,


I am using

winforms reportviewer control for viewing .rdlc files (VS2005/SQL2005).

I would like to know if there was a way to control report header height

or top margin size, programmatically (or by using parameters).

Any

suggestion would be appreciated

Thank you!No, page header height or margin sizes cannot be changed programmatically. You'd need to have different reports that have different values on these properties.

Tuesday, February 21, 2012

ReportViewerWebControl Problem in ASP.net 2.0

hi,

i have used one of the project ReportViewer Web Control , it works fine in local system, but when i put into the server it say

Reserved.ReportViewerWebControl.axd was not found on this server.,

to rectify

i putted blank Reserved.ReportViewerWebControl.axd file into root of the project and i checked

in config file

<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
validate="false" />
</httpHandlers>

this is exist ,

Please can any body help me , i will be thankful to you .

thanks

Dipesh

Hi Dipesh,

You should have report viewer installed on your web server in order to make the report viewer in your pages to work.

Install theMicrosoft Report Viewer Redistributable 2005 SP1 (Full Installation), you can download it from -http://www.microsoft.com/downloads/details.aspx?familyid=E7D661BA-DC95-4EB3-8916-3E31340DDC2C&displaylang=en

and I am having these two setions related to report viewer -

<compilationdebug="true">

<buildProviders>

<addextension=".rdlc"type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

</buildProviders>

</compilation>

<httpHandlers>

<addpath="Reserved.ReportViewerWebControl.axd"verb="*"type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"validate="false"/>

</httpHandlers>

I think it will solve your problem....

ReportViewer's ReportError event handler not firing

Hi.
I want to intercept any errors generated when the report's stored procedure
executes. I've created a handler for the ReportError event but it never
fires.
My web page is in C# and has AutoEventWireup="true". I even tried explicitly
adding a handler...
theReportViewer.ReportError += new ReportErrorEventHandler(explicitHandler);
...but my handlers don't get run.
What have I missed? Is there a property that needs turning on as well as
creating an event handler?
I'm running with VS sp1.
Thanks,
AndrewForgot to say the report is a server report.
Andrew|||Hi Andrew,
From your description, you're wondering how to capture some error raised in
store-procedure(used in SSRS sever report query) in your client ASP.NET
reportviewer,correct?
Based on my research, the ReportViewer control's ReportError event is
implemented as below:
In ReportViewer's rendering code(such as PreRender, or ReportArea's control
creation and rendering methods...), it will wrapper the code with a
try...catch... block and if any exceptions occur, it will check the
"ReportError" event handler and invoke it if registered.
So for your scenario, I think it problem is possible due to the server-side
report's processing is not in reportviewer(but in the server reportserver's
processing engine). Therefore, the related store-procedure error is not
propagate to the client-side reportviewr control and you didn't get the
event raised. To verify this, you can try using a client report and raise
some error in it to see whether the event work. Also, based on my test, if
the report server(server report) not available, it will also raise error.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||Thanks Steven.
I had a poke around with Reflector and was coming to the same conclusion.
Thinking about it, when running async the host page is rendered and returned
whilst the report is still running, so even if the server report errors it
wouldn't have anything to report its error to.
I guess we can always look at the ReportServer log file to see what's
occurred.
Thanks,
Andrew|||Thanks for your reply Andrew,
Yes, your further analysis is also reasonable. Actually, exception
propagating is always quite difficult when dealing with distributed
component or service. Anyway, it is a pleasure to discuss with you on this.
If you meet any other problems later, welcome to discuss here.
Have a nice day!
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

ReportViewer's checked dropdown list control?

I would like to create my own parameter area for my reports which are displayed in an ASP.NET web page with the ASP.NET 2005 ReportViewer control (i.e. I have the ShowParameterPrompts property on my Report Viewer control set to False).

I would like to use the Checked Dropdown List control that allows you to check off each item individually or to check the (Select All) option for my multi-valued parameters.

Is there a way I can create an instance of this checked dropdown control or is there another component out there that is similar to it?

Thanks!!!

Brian

The control is not a public control and can not be created outside of the control. You would need to write your own.

-Daniel

ReportViewer's checked dropdown list control?

I would like to create my own parameter area for my reports which are
displayed in an ASP.NET web page with the ASP.NET 2005 ReportViewer control
(i.e. I have the ShowParameterPrompts property on my Report Viewer control
set to False).
I would like to use the Checked Dropdown List control that allows you to
check off each item individually or to check the (Select All) option for my
multi-valued parameters.
Is there a way I can create an instance of this checked dropdown control or
is there another component out there that is similar to it?
Thanks!!!
BrianMy understanding is that the only extensibility area the Report Viewer
supports is hiding the menus you don't need and writing your own. So, the
short answer is to your question is no. To re-confirm, please post your
question to
http://forums.microsoft.com/msdn/showforum.aspx?forumid=75&siteid=1. This
newsgroup is monitored by Rajeev Karunakaran who is the Program Manager of
the Report Viewer controls.
--
HTH,
---
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/
---
"brianpmccullough" <bmccullough11@.comcast.net> wrote in message
news:72596A04-35ED-434A-B30C-186F3ABB7CAA@.microsoft.com...
>I would like to create my own parameter area for my reports which are
> displayed in an ASP.NET web page with the ASP.NET 2005 ReportViewer
> control
> (i.e. I have the ShowParameterPrompts property on my Report Viewer control
> set to False).
> I would like to use the Checked Dropdown List control that allows you to
> check off each item individually or to check the (Select All) option for
> my
> multi-valued parameters.
> Is there a way I can create an instance of this checked dropdown control
> or
> is there another component out there that is similar to it?
> Thanks!!!
> Brian
>|||Teo,
Thanks for your help. I have posted to the Report Viewer's newsgroup, but
no response...
Any other ways I might be able to see if this "checked dropdown" control is
available for use in an asp.net page?
-Brian
"Teo Lachev [MVP]" wrote:
> My understanding is that the only extensibility area the Report Viewer
> supports is hiding the menus you don't need and writing your own. So, the
> short answer is to your question is no. To re-confirm, please post your
> question to
> http://forums.microsoft.com/msdn/showforum.aspx?forumid=75&siteid=1. This
> newsgroup is monitored by Rajeev Karunakaran who is the Program Manager of
> the Report Viewer controls.
> --
> HTH,
> ---
> Teo Lachev, MVP, MCSD, MCT
> "Microsoft Reporting Services in Action"
> "Applied Microsoft Analysis Services 2005"
> Home page and blog: http://www.prologika.com/
> ---
> "brianpmccullough" <bmccullough11@.comcast.net> wrote in message
> news:72596A04-35ED-434A-B30C-186F3ABB7CAA@.microsoft.com...
> >I would like to create my own parameter area for my reports which are
> > displayed in an ASP.NET web page with the ASP.NET 2005 ReportViewer
> > control
> > (i.e. I have the ShowParameterPrompts property on my Report Viewer control
> > set to False).
> >
> > I would like to use the Checked Dropdown List control that allows you to
> > check off each item individually or to check the (Select All) option for
> > my
> > multi-valued parameters.
> >
> > Is there a way I can create an instance of this checked dropdown control
> > or
> > is there another component out there that is similar to it?
> >
> > Thanks!!!
> >
> > Brian
> >
>
>

ReportViewerControl and SSRS in Sharepoint Integration Mode

Hello,
We can embed server reports in .NET applications by using the ReportViewer
control.
Wondering if this still works when SSRS is running in Sharepoint integrated
mode and the reports in question are hosted within Sharepoint?
Thanks for any help,
JimHi I too have this same question. Now that I have my report server running
in integrated mode - I don't seem to see my report viewer/explorer web parts
any more...
"Jim Plant" wrote:
> Hello,
> We can embed server reports in .NET applications by using the ReportViewer
> control.
> Wondering if this still works when SSRS is running in Sharepoint integrated
> mode and the reports in question are hosted within Sharepoint?
> Thanks for any help,
> Jim|||ok - so the answer is yes - this does work - just needed some experimentation
with settings for the aspx page:
<ServerReport
ReportPath="http://<MyServer>/Documents/rptCountryTFLByIndustrySector.rdl"
ReportServerUrl="http://<MyServer>/ReportServer/"
/>
"TPazz" wrote:
> Hi I too have this same question. Now that I have my report server running
> in integrated mode - I don't seem to see my report viewer/explorer web parts
> any more...
> "Jim Plant" wrote:
> > Hello,
> >
> > We can embed server reports in .NET applications by using the ReportViewer
> > control.
> >
> > Wondering if this still works when SSRS is running in Sharepoint integrated
> > mode and the reports in question are hosted within Sharepoint?
> >
> > Thanks for any help,
> >
> > Jim

ReportViewer1.SetQueryParameter getting message not a member of reportviewer

I am using the reportviewer control in vs2003 accessing the rs2005.

I get the message setqueryparameter is not a member and also i do

****************************************************************

PrivateSub populateReportViewer()

ReportViewer1.ServerUrl = "http://localhost/ReportServer"

ReportViewer1.ReportPath = "/SampleReports/Product Line Sales"

ReportViewer1.SetQueryParameter("ProductCategory", CategoryDropDown.SelectedValue)

ReportViewer1.SetQueryParameter("ProductSubCategory", SubCategoryDropDown.SelectedValue)

ReportViewer1.SetQueryParameter("StartDate", StartDate.Text)

ReportViewer1.SetQueryParameter("EndDate", EndDate.Text)

ReportViewer1.Parameters = Microsoft.Samples.ReportingServices.ReportViewer.multiState.False

ReportViewer1.Format = "HTML4.0"

EndSub

PublicSub SetQueryParameter(ByVal ParamName AsString, ByVal ParamValue AsString)

SetParameter(ParamName, ParamValue)

EndSub

***************************************************************************************

Please can someone provide me a sample code how to use the reportviewer control to call a report via storedproc with parameters.

Please help thank you very much for the information.

see this page : http://www.codeproject.com/aspnet/Reporting_Services.asp

Hope this will help

ReportViewer1.SetQueryParameter getting message not a member of reportviewer

I am using the reportviewer control in vs2003 accessing the rs2005.

I get the message setqueryparameter is not a member and also i do

****************************************************************

Private Sub populateReportViewer()

ReportViewer1.ServerUrl = "http://localhost/ReportServer"

ReportViewer1.ReportPath = "/SampleReports/Product Line Sales"

ReportViewer1.SetQueryParameter("ProductCategory", CategoryDropDown.SelectedValue)

ReportViewer1.SetQueryParameter("ProductSubCategory", SubCategoryDropDown.SelectedValue)

ReportViewer1.SetQueryParameter("StartDate", StartDate.Text)

ReportViewer1.SetQueryParameter("EndDate", EndDate.Text)

ReportViewer1.Parameters = Microsoft.Samples.ReportingServices.ReportViewer.multiState.False

ReportViewer1.Format = "HTML4.0"

End Sub

Public Sub SetQueryParameter(ByVal ParamName As String, ByVal ParamValue As String)

SetParameter(ParamName, ParamValue)

End Sub

***************************************************************************************

Please can someone provide me a sample code how to use the reportviewer control to call a report via storedproc with parameters.

Please help thank you very much for the information.

see this page : http://www.codeproject.com/aspnet/Reporting_Services.asp

Hope this will help

ReportViewer: Show toggle for specific item in a list??

Hello,
Wondering if anyone has any ideas about this:
I have ReportViewer on an ASP page with a report that has a list. The
list shows me rows and I want to be able to toggle just one of the
items in the list based on the type of item it is. Currently I can
only show the toggle icon for all the list items, like this:
+Item1
+Item2
+Item3
But I want the report to show only this:
Item1
+Item2
Item3
I've tried all manner of IIF formulas but none work. Is this even
possible?
ThanksPlease, does anyone have any experience with this?
On Mar 13, 6:11 pm, phrankbo...@.hotmail.com wrote:
> Hello,
> Wondering if anyone has any ideas about this:
> I have ReportViewer on an ASP page with a report that has a list. The
> list shows me rows and I want to be able to toggle just one of the
> items in the list based on the type of item it is. Currently I can
> only show the toggle icon for all the list items, like this:
> +Item1
> +Item2
> +Item3
> But I want the report to show only this:
> Item1
> +Item2
> Item3
> I've tried all manner of IIF formulas but none work. Is this even
> possible?
> Thanks

ReportViewer: creating PDF on the fly

Hi all,

I'm writing a offer web page using ReportViewer control.
This offer page will be shown in PDF format.

I understood that the ReportViewer control can't work without any DataSource, but for my needs I use report parameters and not DataSet (or somesimilar object). So, I defined the unreal DataSet just for deceive the ReportViewer (I don't know if this solution is wise, but probably it's what I ableSmile).

<rsweb:ReportViewer runat="server" ID="ReportViewer1" Font-Names="Verdana" Font-Size="8pt" Height="400px" ShowToolBar="False" Width="685px"> <LocalReport ReportPath="Offer.rdlc" > <DataSources> <rsweb:ReportDataSource DataSourceId="objectDataSource" Name="DataSet1" /> </DataSources> </LocalReport></rsweb:ReportViewer><asp:ObjectDataSource runat="server" ID="objectDataSource" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="DataSet1TableAdapters.MyTableAdapter"></asp:ObjectDataSource>
So far so good. When I activate the offer page, it shown properly, but when I add the following code for create the PFD document from the page, I get an error:
A data source instance has not been supplied for the data source "DataSet1"
protected void Page_Load(object sender, EventArgs e){ Warning[] warnings;string[] streamids;string mimeType;string encoding;string extension;byte[] myBytes =this.ReportViewer1.LocalReport.Render("PDF",null,out mimeType,out encoding,out extension,out streamids,out warnings); Response.Buffer =true; Response.Clear(); Response.ContentType = mimeType; Response.BinaryWrite(myBytes); Response.Flush(); Response.End();}

Please help!

Thanks in advance!

Hi,

Take a look over here :

http://blogs.msdn.com/bimusings/archive/2005/07/01/434659.aspx

HTH,
Suprotim Agarwal

--
http://www.dotnetcurry.com
--

|||

Hi Suprotim Agarwal,

Thank you for the quick response.
I already saw this short article, but it not exactly answers to my case - the error appears only when I create a PDF document from my predefined ReportViewer. If I delete an aforementioned code, the Offer.aspx page work properly.

|||

Hi,

Based on the code you provided, you are going to render the report in the code behind, right?

I think you should declare and add the report datasource explicitly in your code-behind file before you are invoking the render method, see the following code snippet:

protected void Page_Load(object sender, EventArgs e)
{
this.ReportViewer1.ProcessingMode = ProcessingMode.Local;
this.ReportViewer1.LocalReport.ReportPath =
@."c:\Reports\Report1.rdl";
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Sales", LoadSalesData())); declare and add the datasource explicitly.

}
protected void Button1_Click(object sender, EventArgs e)
{
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string extension;

byte[] bytes = ReportViewer1.LocalReport.Render(
"Excel", null, out mimeType, out encoding,
out extension,
out streamids, out warnings);

FileStream fs = new FileStream(@."c:\output.xls",
FileMode.Create);
fs.Write(bytes, 0, bytes.Length);
fs.Close();

Label1.Text = "Report exported to output.xls";

}
}

Thanks.

|||

The problem solved when I moved a code that creates a PDF document from Page_Load to Page_SaveStateComplete event.

Thanks to all of you!

reportviewer: code the windows credentials

I have bought a hosting service for reporting services. The server definitions are set to windows authentication.

I'm using a small application and each time I access a report, a windows prompt asks for the username and password. I would like to avoid this message.

How should I pass the credentials through this application and the reportviewer control (which I use) to the server in order to avoid having to insert the user details in the prompt. This application is to be used by several users and they shouldn't need to insert the account's information.

thank you for a quick reply.

There is no way to add credentials to the report viewer.

Does your local login map to a login on the server at all? If so, Internet Explorer only sends credentials automatically to servers in the Intranet zone, but you can have it automatically send credentials to your host.

You could mark your host as a trusted site (Tools -> Internet Options -> Security), and then tell IE to send credentials automatically to sites in the trusted zone. With Trusted Zones highlighted in the tab, click "Custom Level". Scroll down to the bottom and select "automatic login with current username and password".

|||This can be done. First create a class called ReportServerCredentials that implements the IReportServerCredentials interface. You will need to import System.Net and Microsoft.Reporting.WebForms to this class. Overload the New and GetFormsCredentials methods and the NetworkCredentials and ImpersonationUser properties. Here's a class that I use:

Imports Microsoft.VisualBasic
Imports Microsoft.Reporting.WebForms
Imports System.Net

Public Class ReportServerCredentials
Implements IReportServerCredentials

Private _userName As String
Private _password As String
Private _domain As String

Public Sub New(ByVal userName As String, ByVal password As String, ByVal domain As String)
_userName = userName
_password = password
_domain = domain
End Sub

Public ReadOnly Property ImpersonationUser() As System.Security.Principal.WindowsIdentity Implements Microsoft.Reporting.WebForms.IReportServerCredentials.ImpersonationUser
Get
Return Nothing
End Get
End Property

Public ReadOnly Property NetworkCredentials() As ICredentials Implements Microsoft.Reporting.WebForms.IReportServerCredentials.NetworkCredentials
Get
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
userName = _userName
password = _password
authority = _domain
Return Nothing
End Function
End Class

Next, in the OnLoad of your page with the ReportViewer control, create a new instance of your ReportServerCredentials (I use values stored in AppSettings). Then assign your object to the ReportViewer control's ServerReport.ReportServerCredentials property.

Dim cred As New ReportServerCredentials(ConfigurationManager.AppSettings("MyStoredUser"),_
ConfigurationManager.AppSettings("MyStoredPassword"), _
ConfigurationManager.AppSettings("MyStoredDomain"))

MyReportViewerControl.ServerReport.ReportServerCredentials = cred

A few things can break though-- referenced images on your reports won't render, and you can't use integrated security in your SSRS data sources, unless the account you are impersonating has access to the data as well as SSRS.
|||

Code Salad,

My immeasurable thanks. After three days of searching, your solution was the one that finally got my reports running

|||

It seems CodeSalad's code worked. Can someone explain how it works? Where do I add the code? I am having the same problem. I am using Framework 2.0. Thanks.

DanYeung

|||

I think these links will be helpful -

http://blogs.msdn.com/bimusings/archive/2005/11/18/494436.aspx

http://msdn2.microsoft.com/en-us/library/aa983458(VS.80).aspx

|||

Danyeng,

U have to add a new class file in the app_Code directory

|||

The links and the sample code are very helpful. I still need more help on this. How do I get the ReportViewer control? I am opening the report without using ReportView control. I added the attribute to the button to open the report with Javascript. If I use the ReportViewer control, do I have to open the report differently and how? Thanks.

DanYeung

|||

this is how u doing it.

create a new aspx page and add the report viewer control to ur page by going View Menu -> Toolbox and in the toolbox look under Data.. and then in the properties window, Select the processingmode i.e Remote or local and also specify the report path...

and then in the aspx.vb page in Page_Load sub give this code.

ReportViewer1.ProcessingMode = ProcessingMode.Remote ReportViewer1.ShowCredentialPrompts =True'ReportViewer1.ShowExportControls = False ReportViewer1.ServerReport.ReportServerCredentials =New ReportServerCredentials() ReportViewer1.ServerReport.ReportServerUrl =New Uri("http://IPAddress/ReportServer") ReportViewer1.ServerReport.ReportPath ="/FolderName/Mainrdlfilename" ReportViewer1.ServerReport.Refresh()

ReportViewer1.ServerReport.ReportServerCredentials =New ReportServerCredentials() -- ReportServerCredentials is the base class name of the class that u put in the app_code folder

Hope this helps.

Regards,

Karen

|||

Thanks Karen. I am getting closer. I received the following error:

The path of the item '/Pages/ReportViewer.aspx?nsPortalReports.rptIssuesByRole&rs:Command=Render&intProjectID=119&RunBy=DanYeung' is not valid. The full path must be less than 260 characters long; other restrictions apply. If the report server is in native mode, the path must start with slash. (rsInvalidItemPath)

The report is located in the different project with the same solution. nsPortalReports is the project name and rptIssuesByRole is the report name. What is wrong in the path? Thanks.

DanYeung

|||

is ur report stored in the report server? and if ur reports are stored in the report server is there any kinda directory structure in it...

if u answer this questions may be i can give u a better answer.

Regards

Karen

|||

Yes, I deployed the reports to the report server. Thanks.

DanYeung

|||

are u able to run the reports using the report viewer...

Since ur reports are in the report server just give the path as i have given and it should work... if u need to pass any parameters to the report also let me know i will help u out..

Regards

Karen

|||

How do I run the report using ReportViewer? Yes, I have to pass parameters. So I am not supposed pass parameters in the ReportPath? Is my path correct?

ReportViewer1.ServerReport.ReportPath = "/Pages/ReportViewer.aspx?nsPortalReports.rptIssuesByRole&rs:Command=Render&intProjectID=" & cboProject.SelectedValue & "&RunBy=" & Session("strEmployeeName")

Thanks.

DanYeung

|||

your report Path doesnt Look right to me.

Instead of specifying the report Path... Specify a the ReportServerURL so that u can access ur report server directly. and the url will behttp://IpAddress/ReportServer.

take a look at this code as to how to specify the parameters and the report Path

ReportViewer1.ProcessingMode = ProcessingMode.Remote ReportViewer1.ShowCredentialPrompts =True ReportViewer1.ShowExportControls =False ReportViewer1.ServerReport.ReportServerCredentials =New ReportServerCredentials() ReportViewer1.ServerReport.ReportServerUrl =New Uri("http://IPAddress/ReportServer") s =CType(PreviousPage.FindControl("ddlReportType"), DropDownList).SelectedItem.ValueIf (s ="/Statements/StatementMain")Then ReportViewer1.ServerReport.ReportPath ="/Statements/StatementMain"Dim ClientIDAs String = Session("ClientId")Dim param(0)As Microsoft.Reporting.WebForms.ReportParameter'param(0) = New Microsoft.Reporting.WebForms.ReportParameter("PeriodId", "") param(0) =New Microsoft.Reporting.WebForms.ReportParameter("ClientId", ClientID,False) ReportViewer1.ServerReport.SetParameters(param)ReportViewer1.ServerReport.Refresh()End If
 
u can omit the parameters so that u can directly set them while u run the reports.Hope this helps.

Regards,

Karen

ReportViewer.SizeToReportContent - has anyone got an example?

I have an aspx 2.0 page using the ReportViewer control on SRS2005.
The report I am showing has drillthroughs to multiple other reports,
some of which fit on the screen and some are wider than the screen.
I would like to dynamically size the control so it matches the
interactive size of the report currently being displayed by drill
through. That way scroll bars would appear on the outside of the web
browser only when required.
I cant figure out how to do this.
I have tried setting ReportViewer1.SizeToReportContent = true; in both
ReportViewer_Drillthrough and Page_Load events but to no avail.
Has anyone got an example of this working?
Thanks,
Renato
To be clear this is what I have in the aspx:
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Enabled="true"
Width="98%" Height="600px"
OnDrillthrough = "ReportViewer1_Drillthrough">
</rsweb:ReportViewer>
In the cs:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
ReportViewer1.PromptAreaCollapsed = true;
ReportViewer1.ShowBackButton = true;
ReportViewer1.HyperlinkTarget = "_self";
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
Systm.Uri oReportServer = new
System.Uri("http://wrypgpdbs04/ReportServer/");
ReportViewer1.ServerReport.ReportServerUrl = oReportServer;
ReportViewer1.ServerReport.ReportPath = "/PGP/Sales/DailySales/DailySalesNavigation";
ReportViewer1.SizeToReportContent = true;
}
}
protected void ReportViewer1_Drillthrough(object sender,
Microsoft.Reporting.WebForms.DrillthroughEventArgs e)
{
ReportViewer1.SizeToReportContent = true;
}Hi, RBot
I would recommend removing the width and height property from the
declaration of the ReportViewer control, to see if that CSS style for
the control is not overriding the SizeToReportContent property. It
would seem that even though you set the property to true, you're
constraining the control in the browser by using those 2 style tags.
Hope that works.
Thiago
On Nov 22, 9:38 pm, "RBot" <renato_b...@.iprimus.com.au> wrote:
> I have an aspx 2.0 page using the ReportViewer control on SRS2005.
> The report I am showing has drillthroughs to multiple other reports,
> some of which fit on the screen and some are wider than the screen.
> I would like to dynamically size the control so it matches the
> interactive size of the report currently being displayed by drill
> through. That way scroll bars would appear on the outside of the web
> browser only when required.
> I cant figure out how to do this.
> I have tried setting ReportViewer1.SizeToReportContent = true; in both
> ReportViewer_Drillthrough and Page_Load events but to no avail.
> Has anyone got an example of this working?
> Thanks,
> Renato
> To be clear this is what I have in the aspx:
> <rsweb:ReportViewer ID="ReportViewer1" runat="server" Enabled="true"
> Width="98%" Height="600px"
> OnDrillthrough = "ReportViewer1_Drillthrough">
> </rsweb:ReportViewer>
> In the cs:
> protected void Page_Load(object sender, EventArgs e)
> {
> if (!Page.IsPostBack)
> {
> ReportViewer1.PromptAreaCollapsed = true;
> ReportViewer1.ShowBackButton = true;
> ReportViewer1.HyperlinkTarget = "_self";
> ReportViewer1.ProcessingMode => Microsoft.Reporting.WebForms.ProcessingMode.Remote;
> Systm.Uri oReportServer = new
> System.Uri("http://wrypgpdbs04/ReportServer/");
> ReportViewer1.ServerReport.ReportServerUrl = oReportServer;
> ReportViewer1.ServerReport.ReportPath => "/PGP/Sales/DailySales/DailySalesNavigation";
> ReportViewer1.SizeToReportContent = true;
> }
> }protected void ReportViewer1_Drillthrough(object sender,
> Microsoft.Reporting.WebForms.DrillthroughEventArgs e)
> {
> ReportViewer1.SizeToReportContent = true;
>
> }- Hide quoted text -- Show quoted text -|||Thanks Thiago,
I tried this but still get the scrollbars around a iframe-like area.
The report viewer now seems to inherit the width from its containing
div element, which in turn gets it from a shared stylesheet. I can set
the width of the div, but this is static, not responsive to the size of
the report.
I dont know what style to use to reset the width back to "vanilla".
tafs7 wrote:
> Hi, RBot
> I would recommend removing the width and height property from the
> declaration of the ReportViewer control, to see if that CSS style for
> the control is not overriding the SizeToReportContent property. It
> would seem that even though you set the property to true, you're
> constraining the control in the browser by using those 2 style tags.
> Hope that works.
> Thiago
>
> On Nov 22, 9:38 pm, "RBot" <renato_b...@.iprimus.com.au> wrote:
> > I have an aspx 2.0 page using the ReportViewer control on SRS2005.
> >
> > The report I am showing has drillthroughs to multiple other reports,
> > some of which fit on the screen and some are wider than the screen.
> > I would like to dynamically size the control so it matches the
> > interactive size of the report currently being displayed by drill
> > through. That way scroll bars would appear on the outside of the web
> > browser only when required.
> > I cant figure out how to do this.
> >
> > I have tried setting ReportViewer1.SizeToReportContent = true; in both
> > ReportViewer_Drillthrough and Page_Load events but to no avail.
> >
> > Has anyone got an example of this working?
> >
> > Thanks,
> > Renato
> >
> > To be clear this is what I have in the aspx:
> > <rsweb:ReportViewer ID="ReportViewer1" runat="server" Enabled="true"
> > Width="98%" Height="600px"
> > OnDrillthrough = "ReportViewer1_Drillthrough">
> > </rsweb:ReportViewer>
> > In the cs:
> > protected void Page_Load(object sender, EventArgs e)
> > {
> > if (!Page.IsPostBack)
> > {
> > ReportViewer1.PromptAreaCollapsed = true;
> > ReportViewer1.ShowBackButton = true;
> > ReportViewer1.HyperlinkTarget = "_self";
> > ReportViewer1.ProcessingMode => > Microsoft.Reporting.WebForms.ProcessingMode.Remote;
> > Systm.Uri oReportServer = new
> > System.Uri("http://wrypgpdbs04/ReportServer/");
> > ReportViewer1.ServerReport.ReportServerUrl = oReportServer;
> > ReportViewer1.ServerReport.ReportPath => > "/PGP/Sales/DailySales/DailySalesNavigation";
> > ReportViewer1.SizeToReportContent = true;
> > }
> >
> > }protected void ReportViewer1_Drillthrough(object sender,
> > Microsoft.Reporting.WebForms.DrillthroughEventArgs e)
> > {
> > ReportViewer1.SizeToReportContent = true;
> >
> >
> >
> > }- Hide quoted text -- Show quoted text -|||Just for the record I have sorted my issues with the ReportViewer web
control.
In the report definitions I need to ensure that the Report dimensions
are larger than the Page dimensions plus margins.
Once this is done the scrollbars dont appear for the ReportViewer
control.
Strangely this is never a problem when viewing reports directly on the
report server via http.
Renato

ReportViewer, VS2005 and SSRS 2005

I have developed a web app that uses forms authentication. I wrote it in asp.net 2.0. My server is running windows 2003 server standard and IIS. I have also installed on the same machine SQL Server 2005 with Reporting Services.

From my webapplication, I have a button that the user can click and then I have the Report Viewer control generate a report. However, I do not know how to pass the proper credentials to the report server. I would like to pass one username and password that has permissions to run that report. My code is follows:

Private Sub saveRptAs(ByVal s_rptType As String)
Dim warnings As Microsoft.Reporting.WebForms.Warning()
Dim streamids As String()
Dim mimeType As String
Dim encoding As String
Dim extension As String

ReportViewer1.ServerReport.ReportServerUrl = New Uri("http://myserver/reportserver")
ReportViewer1.ServerReport.ReportPath = "/reports/Individual Report"


Dim test As New NetworkCredential("localuser", "password", "domain")

ReportViewer1.ServerReport.ReportServerCredentials = test

Dim rprameter As ReportParameter = New ReportParameter("user_no", Profile.DTGVariables.SelectedYMNo)
Me.ReportViewer1.ServerReport.SetParameters(New ReportParameter() {rprameter})

Dim bytes As Byte() = ReportViewer1.ServerReport.Render(s_rptType, Nothing, mimeType, encoding, extension, streamids, warnings)
Response.Buffer = True
Response.Clear()
Response.ContentType = mimeType
Response.AddHeader("content-disposition", "attachment; filename=sample." + extension)
Response.BinaryWrite(bytes)
Response.Flush()
Response.End()
End Sub

When I click on the button I get the following message:

Unable to cast object of type 'System.Net.NetworkCredential' to type 'Microsoft.Reporting.WebForms.IReportServerCredentials'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.InvalidCastException: Unable to cast object of type 'System.Net.NetworkCredential' to type 'Microsoft.Reporting.WebForms.IReportServerCredentials'.

Can someone help me with the credentials issue? Do I need to change Reporting Services to use Forms Authentication?

Your help and insight is greatly appreciated.

Thanks

Nate Dogg

put your credentials in web.config, that's how i worked around it

<identityimpersonate="true"userName="Domain\user"password="password"/>

|||try this - works for me
... ServerReport report = ReportViewer1.ServerReport; report.ReportServerCredentials = new MyReportServerCredentials(); ... class MyReportServerCredentials : IReportServerCredentials{ public MyReportServerCredentials() { } public System.Security.Principal.WindowsIdentity ImpersonationUser { get { return null; // Use default identity. } } public System.Net.ICredentials NetworkCredentials { get { return new System.Net.NetworkCredential("user", "pass", "domain"); } } public bool GetFormsCredentials(out System.Net.Cookie authCookie, out string user, out string password, out string authority) { authCookie = null; user = password = authority = null; return false; // Not use forms credentials to authenticate. } }
|||

Hey guys this is killing me also. I am using webhosting4life.com as my hosting company and have reporting services. I am trying the same thing the original poster is doing and getting the same error message. When I try the impersonate user I get the following error message. All I truly want is for the report viewer to pull open the report and display to the end user...but I need to pass my user name and password over....PLEASE HELP!! I have read several books and none of them touch on this.

Configuration Error

Description:An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message:Could not create Windows user token from the credentials specified in the config file. Error from the operating system 'Unspecified error
'

|||

It appears the error is in the web.config. Implementing theIReportServerCredentials as shown in the previous article works and is a good solution to only having the SRS work under that user context.

ReportViewer's checked dropdown list control?

I would like to create my own parameter area for my reports which are displayed in an ASP.NET web page with the ASP.NET 2005 ReportViewer control (i.e. I have the ShowParameterPrompts property on my Report Viewer control set to False).

I would like to use the Checked Dropdown List control that allows you to check off each item individually or to check the (Select All) option for my multi-valued parameters.

Is there a way I can create an instance of this checked dropdown control or is there another component out there that is similar to it?

Thanks!!!

Brian

The control is not a public control and can not be created outside of the control. You would need to write your own.

-Daniel

Reportviewer working over ssl(fortress) using Firefox, but not over ssl using IE

Hello,

I have a local report - using the reportviewer control - being displayed to internet users over an ssl connection (Fortress). The report works find in Safari and Firefox web browsers, but does not display in I.E.

What happens is the reportviewer acts like it is going to display the report properly, but as soon as the "Report is being Generated" message ends, the report viewer control tool bar drops to the bottom of the page effectively not showing the report. I can click export on the tool bar - that works as expected and allows me to download the report as an excel or pdf file, but inside I.E. I cannot see the report.

Any suggestions?


Thanks!!!!!!!!!!

Big Smile I solved the problem. The issue was the reportviewer control was embedded inside an aspx table cell. In the process of troubleshooting, I deleted the aspx table, so the control was just inside an aspx panel. Deleting the table allowed the reportviewer to render properly over ssl.

What made the hard to figure was it worked great over plain http with IE, but not https(ssl). Ironically, the viewer worked great over ssl when using firefox.

Cheers!

Reportviewer with Multivalue Parameter and FireFox

Hi,

I'm experiencing a problem with the multivalue parameter dropdown in ReportViewer control in FireFox. It works fine in IE. The problem is when I click on dropdown list with multivalue parameters, the list of options appears then quickly disappers before I can select anything. This problem occurs only for multivalue parameters. The dropdown is also grayed-out. Also, the dropdown options are not displayed in the correct position (it is pushed all the way to the left). If a navigate directly to the reportserver and view the report there it works fine so I'm guessing that the problem is with the Reportviewer control in Firefox.

Has anyone else come across this problem?

Thanks!

try deleting the line in the aspx file that sets the doctype to XHTML it worked for us, although did cause some other issues which we then had to rectify.

|||I tried deleting the DOCTYPE element but it causes other issues - the page stysheets and themes didn't render correctly. Also, the page with a reportviewer control is in a master page. :(

|||

we had the same issue and ended up creating a second master page for the reports so all of our other pages could keep the doc type line. As far as I'm aware its a bug with reporting services and this is the only workaround I've been able to find. To be honest the more I use reporting servies the more it feels like an unfinished product.

ReportViewer with Authentication

I'm new to Reporting Services but have built some reports and have implemented them. I have used the report viewer which works great and has a great tool bar that users really like. One problem, I can't figure out how to pass network credentials using the viewer.

If I use the ReportingService class I can pass the credentials and everything is great except that I lose the nice tool bar.

I want the best of both worlds without having th build my own toolbar. This must have been done before but I can't seem to find any samples.

So is there a way to pass credentials (Basic Authentication over SSL) while still using the nivce features from the ReportViewer.

Or

Is there a different ReportViewer that has this capability.

Any help will be greatly appreciated.

ThanksDoes anyone have any info on this? Does a ReportViewer control with the ability to pass credentials exist or do I need to create my own?

Thanks,
|||the short answer is "yes".

the devil is in the details...
are you using rs 2000 or 2005 ?
if 2005 I am also trying to get the details down.

I did some work with rs 2000 and see that a lot is the same but the winforms control is new and I hear they "made things better" but so far found few samples of how to get from "A" to "B".
I do know that there are two calls that deal with auth, one to pass data-source credentials and one to pass in "access" credentials.

the access bits seem to have several options.

when I was doing some hacking throuhg they did not seem to work.

I think that was due to messing with the report server and hosing it's settings.

right now I am building a test-lab with a local server and a Virtual PC to run my client app.

I hope I can get a sample working and share....

Big Smile|||I'm using RS 2000. We may go to 2005 in the future but the immediate need is for 2000.

|||

mcatet wrote:

I'm using RS 2000. We may go to 2005 in the future but the immediate need is for 2000.

Ok, a few things:

1) you want to use *WINDOWS* credentails
2) look at the docs and as I recall you will see that you needs to create an object and then attach it to your calls.... System.Net.NetworkCredentails
you can create one with user,pass,domain and then pass that to the web services at key points.

I am working 2005 now so I'm not readig the 2000 docs right now but I think that the above will start you in the right direction....|||Ok. So with windows credentials setup on the ReportServer web folder, I just need a windows domain account on the server (LocalServerDomain\RSExec). Then pass those credentials.

I have that part working using the ReportingServices class.

What would be really nice is if I could use the Microsoft ReportViewer control for my reports (because I like the appearance of it) while still passing the credentils to it. The ReprotingServices class has a viewer toolbar but it doesn't look as nice.

Is this possible, and if so, do you have sample code I could look at?

Thanks for your help.

|||Just keeping this up front so people see it.

Anyone else have an additional info pertaining to an RS2000 ReportViewer with authentication being passed?

Thanks,
|||I am using RS2005.
IF i call ReportingService2005 web service, i know how i can use windows credentails. for this i use NetworkCredentails. However, i couldnt find out how i can set reportviewer credentails to windows credentails.
Could u help me?|||

Looks like this has been sitting around for a little while:

for SSL - set the URL of the ReportViewer control to start with https.

for specifying the credentials to use, you should use the IReportServerCredentials Interface

http://msdn2.microsoft.com/en-us/library/microsoft.reporting.winforms.ireportservercredentials.aspx

Hope that helps,

-Lukasz

ReportViewer with Authentication

I'm new to Reporting Services but have built some reports and have implemented them. I have used the report viewer which works great and has a great tool bar that users really like. One problem, I can't figure out how to pass network credentials using the viewer.

If I use the ReportingService class I can pass the credentials and everything is great except that I lose the nice tool bar.

I want the best of both worlds without having th build my own toolbar. This must have been done before but I can't seem to find any samples.

So is there a way to pass credentials (Basic Authentication over SSL) while still using the nivce features from the ReportViewer.

Or

Is there a different ReportViewer that has this capability.

Any help will be greatly appreciated.

ThanksDoes anyone have any info on this? Does a ReportViewer control with the ability to pass credentials exist or do I need to create my own?

Thanks,
|||the short answer is "yes".

the devil is in the details...
are you using rs 2000 or 2005 ?
if 2005 I am also trying to get the details down.

I did some work with rs 2000 and see that a lot is the same but the winforms control is new and I hear they "made things better" but so far found few samples of how to get from "A" to "B".
I do know that there are two calls that deal with auth, one to pass data-source credentials and one to pass in "access" credentials.

the access bits seem to have several options.

when I was doing some hacking throuhg they did not seem to work.

I think that was due to messing with the report server and hosing it's settings.

right now I am building a test-lab with a local server and a Virtual PC to run my client app.

I hope I can get a sample working and share....

Big Smile|||I'm using RS 2000. We may go to 2005 in the future but the immediate need is for 2000.

|||

mcatet wrote:

I'm using RS 2000. We may go to 2005 in the future but the immediate need is for 2000.

Ok, a few things:

1) you want to use *WINDOWS* credentails
2) look at the docs and as I recall you will see that you needs to create an object and then attach it to your calls.... System.Net.NetworkCredentails
you can create one with user,pass,domain and then pass that to the web services at key points.

I am working 2005 now so I'm not readig the 2000 docs right now but I think that the above will start you in the right direction....|||Ok. So with windows credentials setup on the ReportServer web folder, I just need a windows domain account on the server (LocalServerDomain\RSExec). Then pass those credentials.

I have that part working using the ReportingServices class.

What would be really nice is if I could use the Microsoft ReportViewer control for my reports (because I like the appearance of it) while still passing the credentils to it. The ReprotingServices class has a viewer toolbar but it doesn't look as nice.

Is this possible, and if so, do you have sample code I could look at?

Thanks for your help.

|||Just keeping this up front so people see it.

Anyone else have an additional info pertaining to an RS2000 ReportViewer with authentication being passed?

Thanks,
|||I am using RS2005.
IF i call ReportingService2005 web service, i know how i can use windows credentails. for this i use NetworkCredentails. However, i couldnt find out how i can set reportviewer credentails to windows credentails.
Could u help me?|||

Looks like this has been sitting around for a little while:

for SSL - set the URL of the ReportViewer control to start with https.

for specifying the credentials to use, you should use the IReportServerCredentials Interface

http://msdn2.microsoft.com/en-us/library/microsoft.reporting.winforms.ireportservercredentials.aspx

Hope that helps,

-Lukasz

ReportViewer with Authentication

I'm new to Reporting Services but have built some reports and have implemented them. I have used the report viewer which works great and has a great tool bar that users really like. One problem, I can't figure out how to pass network credentials using the viewer.

If I use the ReportingService class I can pass the credentials and everything is great except that I lose the nice tool bar.

I want the best of both worlds without having th build my own toolbar. This must have been done before but I can't seem to find any samples.

So is there a way to pass credentials (Basic Authentication over SSL) while still using the nivce features from the ReportViewer.

Or

Is there a different ReportViewer that has this capability.

Any help will be greatly appreciated.

ThanksDoes anyone have any info on this? Does a ReportViewer control with the ability to pass credentials exist or do I need to create my own?

Thanks,
|||the short answer is "yes".

the devil is in the details...
are you using rs 2000 or 2005 ?
if 2005 I am also trying to get the details down.

I did some work with rs 2000 and see that a lot is the same but the winforms control is new and I hear they "made things better" but so far found few samples of how to get from "A" to "B".
I do know that there are two calls that deal with auth, one to pass data-source credentials and one to pass in "access" credentials.

the access bits seem to have several options.

when I was doing some hacking throuhg they did not seem to work.

I think that was due to messing with the report server and hosing it's settings.

right now I am building a test-lab with a local server and a Virtual PC to run my client app.

I hope I can get a sample working and share....

Big Smile|||I'm using RS 2000. We may go to 2005 in the future but the immediate need is for 2000.

|||

mcatet wrote:

I'm using RS 2000. We may go to 2005 in the future but the immediate need is for 2000.

Ok, a few things:

1) you want to use *WINDOWS* credentails
2) look at the docs and as I recall you will see that you needs to create an object and then attach it to your calls.... System.Net.NetworkCredentails
you can create one with user,pass,domain and then pass that to the web services at key points.

I am working 2005 now so I'm not readig the 2000 docs right now but I think that the above will start you in the right direction....|||Ok. So with windows credentials setup on the ReportServer web folder, I just need a windows domain account on the server (LocalServerDomain\RSExec). Then pass those credentials.

I have that part working using the ReportingServices class.

What would be really nice is if I could use the Microsoft ReportViewer control for my reports (because I like the appearance of it) while still passing the credentils to it. The ReprotingServices class has a viewer toolbar but it doesn't look as nice.

Is this possible, and if so, do you have sample code I could look at?

Thanks for your help.

|||Just keeping this up front so people see it.

Anyone else have an additional info pertaining to an RS2000 ReportViewer with authentication being passed?

Thanks,
|||I am using RS2005.
IF i call ReportingService2005 web service, i know how i can use windows credentails. for this i use NetworkCredentails. However, i couldnt find out how i can set reportviewer credentails to windows credentails.
Could u help me?|||

Looks like this has been sitting around for a little while:

for SSL - set the URL of the ReportViewer control to start with https.

for specifying the credentials to use, you should use the IReportServerCredentials Interface

http://msdn2.microsoft.com/en-us/library/microsoft.reporting.winforms.ireportservercredentials.aspx

Hope that helps,

-Lukasz