Tuesday, October 19, 2010

Print specific ASP.Net control from a Web Page

I ran into a requirement, where i had to print only asp.net grid. And this had to work on all browsers. I had similar requirement to print a SSRS report on non IE browser.
So, I came up with this solution(rather, i would call it as workaround). Approach is to select the inner html of the control and print only this area. To do so, i am selecting the inner html  from the control and setting it as a HTML source of an IFRAME which is of size 0x0 and printing it immediately.
Following is the Javascript from the aspx page to this. I have taken reportviewer control for now.








If you are using this for reportviewer, just keep in mind that you are only printing the current page instead of all the visible pages.



I still need to work on getting the styles from the parent page and applying it on the IFRAME so that we dont miss any style information.

Friday, October 15, 2010

Error:Microsoft.ReportingServices.Diagnostics.Utilities.SecureConnectionRequiredException: The operation you are attempting requires a secure connection (HTTPS)

I had this problem from long time and was in such a urgency that i started working with HTTPS. But finally i had to move my machine out of the domain, and left with only option of fixing it.

First step i did was went to “C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\LogFiles”, which you have already figured out i guess. At the latest log file, you will see this error listed. Which means that RS is configured only for HTTPS and not for HTTP.

To resolve… lets change it.

For not using SSL you need to modify following section in reportserver.config file, at C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer and change

<Add Key="SecureConnectionLevel" Value="2"/>




entry with value from 2 to “0”