AsyncRendering in ReportViewer

I have a report that has 11 pages, When i have the Asyncrendering option to true, I can navigate to the all the pages. But when I set the Asyncrendering option to false, the first page displays but on clicking the next pages I get a page navigation error. I wanted to know what this option really does. When Asyncrendering option is true, I believe it has to get the whole report - all the pages, but when asyncrendering is false, how do you tell the report viewer to get the next page. I saw that there are page navigation events on the report viewer but don't know how to code for them. Any help/suggestion is appreciated.

Thanks

[645 byte] By [AratiR] at [2008-1-10]
# 1

When asyncrendering is false, the entire aspx page will be blocked until the report has rendered. Because of this limitation, it is typically used on small reports. Additionally, because everything is synchronous, all page navigations and report interactions will cause a postback. In async mode, the page does not postback (only the iframe updates) unless the developer has hooked up to a relevant viewer event, such as the PageNavigation event.

Can you be more specific about the error you are receiving? What is the exact text of the message?

BrianHartman-MSFT at 2007-10-3 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 2

Hi,

I am in a similar situation. I do not want those scroll bars that appear in iFrame. So I set AsyncRendering = false; After doing that, scrollbars do dissappear but I cannot navigate thru the report pages. I load the report once when (IsPostBack == false) and I have nothing in (IsPostBack == true). I have a button that loads the report again if clicked. Page Navigation works when the report is loaded thru this button but does not work when loaded for first time in Page_Load( { if(IsPostBack == false) } )

Please help,

Max

bullpit at 2007-10-3 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 3
When you say that page navigation doesn't work, can you be more specific? Do you get an error message? Is it just blank? Does it redisplay the same page? Does the toolbar page number update?
BrianHartman-MSFT at 2007-10-3 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 4

What I mean by writing that page navigation doesn't work is that I get the first page and toolbar ok, but when I click on the next (->) button on the toolbar, it either gives me the error "Page Navigation is Out of Range" in the report area or the whole reportviewer dissappears (thats probably because Asynsrendering=false and thus since the report does not have any data due to the error, it justs sqeezes to nothing). I may have found the problem but I am not sure whether I am right. I have a backup copy of my project when it was in its intial stages and tested that one and it works fine. The difference I found was that I am not loading the report in Page_Load event in my backup copy. I load it when the user clicks a button (postback).

protected void bttnViewFullRep_Click(object sender, EventArgs e)

{

// Set the processing mode for the ReportViewer to Local

ReportViewer1.ProcessingMode = ProcessingMode.Local;

LocalReport rep = ReportViewer1.LocalReport;

rep.ReportPath = "Report.rdlc";

DataSet ds = GetSalesDataFull();

// Create a report data source for the sales order data

ReportDataSource dsMain = new ReportDataSource();

dsMain.Name = "DataSet1_Main";

dsMaintenanceDS.Value = ds.Tables["Main"];

rep.DataSources.Clear();

rep.DataSources.Add(dsMaintenanceDS);

rep.Refresh();

}

private DataSet GetSalesDataFull()

{

DataSet ds = new DataSet();

string str = @" WHERE... "'";

string sqlSalesData = @"SELECT * FROM Main m" + str;

OdbcConnection connection = new OdbcConnection("...");

OdbcCommand command = new OdbcCommand(sqlSalesData, connection);

OdbcDataAdapter salesOrderAdapter = new OdbcDataAdapter(command);

salesOrderAdapter.Fill(ds, "Main");

salesOrderAdapter.Dispose();

command.Dispose();

return ds;

}

But in my new application, this all happens in if(!IsPostBack){}

Does this help identifying the problem?

Thanks a lot,

bullpit

bullpit at 2007-10-3 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 5

Theres another difference that in the new application, I set the column names and details thru parameters from the codebehind.

So, the column name will be set like this:

=Parameters!param1.Value

and details row will be set like this:

=Fields(Parameters!param1.Value).Value

For some reson, even the Interactive sort does not work the way it should. In my older application, Intercative sort works on the whole dataset but in the new application, it only works for page that is being displayed.

Hope this helps...

Thanks,

bullpit

bullpit at 2007-10-3 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 6
Anyone!!!? Pleas help, I don't want to use Asyncrendering because of those pesky scrollbars that appear in the frame. I want the reportviewer to be inline so that it automatically adjusts its height according to the number or rows.
bullpit at 2007-10-3 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 7

I figured out what was up with the report viewer control that was causing paging and sorting to not work when AsyncRendering="false" and 'disappear' on postback. If you are setting parameters programmatically, the problem was that any nullable report parameter was being changed from null to “” (empty string) on postback. The issue is related to the MS provided report parameter area (that can be set to be not visible through the ShowParameterPrompts parameter) causing the nullable parameter to be set to empty string on postback (i.e. even though the parameter section was set to not be visible, that textbox for the nullable parameter was still causing the value of empty string was being read from it and overwrite our previously null parameter. This parameter changed caused the report to think the parameters were updated and thus put the control in a not ready to render state (thus it would not render at all, even the toolbar). The fix is to set the nullable parameter to be non-visible and then add it your ReportParameter[]. Hope this helps.

ReportParameter rp = new ReportParameter("yourNullableParam");

rp.Visible = false;

OR (a better approach)

Set the nullable parameter to be hidden in the rdl.

kevindotnet at 2007-10-3 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 8

wow...patience pays...some deep thoughts there. Though I adapted my application according what I had, I will still give it a try and see if it works.

Thank you so much....

bullpit

bullpit at 2007-10-3 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 9

My suggestion is to disable Asyncrendering option (so on clicking the next page, entire page will be postbacked) and control your PageLoad function. If you prefer to enable Asyncrendering, you cannot put ReportViewer into html page directly, you should put into IFrames or AjaxEnabled site.

benjcev at 2007-10-3 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...
# 10

well...I finally got a solution here and it works. It is similar to what is said about using Reportviewer with reporting services.

Have a look at this.

http://forums.asp.net/p/1078091/1588267.aspx#1588267

bullpit at 2007-10-3 > top of Msdn Tech,Visual Studio,Visual Studio Report Controls...

Visual Studio

Site Classified