Tuesday, February 21, 2012

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

No comments:

Post a Comment