Archive for the ‘ASP.NET’ Category

To add alternating row color to SQL Server Reporting Services Report, right click on the report property and add the follow:

Private bOddRow As Boolean
‘*************************************************************************
‘ — Display green-bar type color banding in detail rows
‘ — Call from BackGroundColor property of all detail row textboxes
‘ — Set Toggle True for first item, False for others.
‘*************************************************************************
Function AlternateColor( ByVal Toggle As Boolean,Byval rowNumber as integer) As String
dim OddColor As String = “Green”
Dim EvenColor As String = “White”

if rowNumber mod 2 = 0 then
Return OddColor
Else
Return EvenColor
End If
End Function

Then in each field in the table row’s BackgroundColor property and choose “Expression” and add:

=Code.AlternateColor(True, rownumber(nothing))

Reporting Services 2005 PDF rendering with SQL Server 2005 Service Pack 3 is not full font embedding like Reporting Services 2008. The font embedding in Reporting Services 2005 SP3 is limited to non ANSI characters. If there are Unicode Glyphs missing on the server, you may see characters replaced with a question mark (?). If there is a font missing on the client, you may see characters replaced with boxes (□). To get full font embedding (including ANSI characters) you would have to get Cumulative update package 1 for SQL Server 2008 (or greater). Overall, with font embedding it does no longer matter what version of a font is installed on a client – the documents can be viewed the same way regardless of client operating systems, font versions, and client PDF viewer.

To remove border and margin on SQL Server Reporting Services Report iframe just add the following:

<frame scrolling=’no’ frameborder=’0′ marginheight=’0′ marginwidth=’0′ style=’width: 100%;’ src=’Report.aspx’ />

An easy way to maintain the current scroll position across postbacks in ASP.NET is to use the MaintainScrollPositionOnPostback page directive attribute. This is useful if you are working on big pages where scrolling is necessary, and works in most common browsers.

There are three ways of applying the property to a web page.

  1. You can set it programmatically

    Page.MaintainScrollPositionOnPostBack = true;
  2. In the page declaration

    <%@ Page MaintainScrollPositionOnPostback=”true” %>
  3. Or in the web.configs <system.web> section.

    <pages maintainScrollPositionOnPostBack=”true” />