Monday, August 5, 2013

How to Get SQL Report Services Report Built With Report Builder to Display No Page Breaks on Screen, But Still Break When Printed

I created a report with Report Builder 3.  My users are us to seeing reports displayed on screen with no page breaks.  It looks like the default is to have page breaks.  I found that in the report properties there are a couple of properties to manage page breaks.

In Report Builder, right click outside the report body and click Report Properties.  In the properties window there is a page section when you have it sorted by property category.  In that section there is a property called InterActiveSize.  If you set the height and the width of this property both to be 0 the report is displayed on screen in one long page with no breaks.

The other property is PageSize.  This has to do with the printed page.  It is right below the margin property where you can control margins.  I think this only controls them for the printed page.

Friday, August 2, 2013

Data Bound GridView and Asp.Net Ajax UpdatePanel

I tried loading a couple of grids through an update panel with a timer to try to get the rest of the page to display to the user quickly and do the heavy lifting of these two grids in the background.

I wrapped the two grids in an update panel and added a timer.  I put code in the tick event of the timer.  I loaded the page and it came up quickly and moments later the grids filled in.  Moments after that all of my dynamic data i have created with template fields was erased.  The main data that was being bound was still there.

As I researched it I found that the RowCreated event was firing repeatedly.  I viewed the call stack and saw that it was being fired by system code that I could not see and not by my code.

I tried using session variables to get it to routed around the multiple calls, but the damage was being done before it got to the RowCreated event.  The event also was getting null values for ID fields I was using to populate the grid correctly, which is why the dynamic data was not being displayed.

I did a couple of hours of research, but found nothing specific to my problem, but I did start stumbling upon two properties of the update panel, ChildrenAsTriggers and UpdateMode.  Honestly I don't entirely understand UpdateMode yet, but ChildrenAsTriggers got me thinking that maybe the grid was triggering a refresh of its own somehow after I got everything set the way I wanted it.

I set ChildrenAsTriggers="false".  It required that I have UpdateMode="Conditional".  I think this also required that I have an explicit Trigger tag for the update panel that was set to the Tick event of my timer.

After all that, it appears to be working.