Thursday 25 August 2011

Pass Dynamic Connection String to SSRS Reports

SSRS 2005 ReportViewer is 'Shrinking' my Reports

I've found the solution to SSRS shrinking my reports. For reference, you have to do three things
  1. Delete the declaration from my hosting aspx page
  2. Set the Report Viewer's AsyncRendering property to false.
  3. Set the Report Viewer's Width property to 100%
Apparently there is a bug in SSRS 2005 with its XHTML rendering engine which is now fixed with the engine rebuild in SSRS 2008.

Tuesday 9 August 2011

RegisterStartupScript vs RegisterClientScriptBlock


I have a site with loads of pages with Ajax tabbed containers on them. Generally each tabbed container is contained within an Update Panel. Some have additional Update Panels on the tabs.

Whenever a user clicks an Update button, I go back to the server, check if they have permission to do the action they are doing and, if they don't return to the page and EITHER do this:



I find, on various pages, one works and the other does not. If I'm using RegisterClientScriptBlock and the alert does not show, I change it to RegisterStartupScript - and it works - the alert shows.

But the reverse can also be true. Sometimes RegisterStartupScript does not work, and if I change it to RegisterClientScriptBlock it works.

I have checked this out in detail on different pages - where the code is pretty much identical i.e. there is an Update Panel containing a tabbed container and nothing else. Sometimes I have to use RegisterStartupScript - sometimes I have to use RegisterClientScriptBlock.

RegisterClientScriptBlock -> Put a function or a block of code (javascript) on the page which you may not want executed immediately.

RegisterStartupScript -> Put some code on the page which you want executed as soon as the page finishes loading.