IPN delivery failed. Unable to connect to the specified URL. Please verify the URL and try again. Solution

This post is just a self reminder !

While testing PayPal Instant Payment Notification (IPN) I have set the IPN handler URL to website on port 9999 like the following

http://xx.xxx.xx.xx:9999/handler.aspx

The result was

IPN delivery failed. Unable to connect to the specified URL. Please verify the URL and try again

The Solution was to change the URL of the handler to post to port 80 like the following

http://xx.xxx.xx.xx/handler.aspx

Categories: PayPal Tags:

SSRS 2008 Tablix Alternate Row Colors

In this post I am going to show how to handle alternate row coloring in three scenarios

  1. Simple Tablix with static columns that render set of rows
  2. Tablix with static columns and contains row grouping
  3. Tablix with dynamic columns and contains row grouping

Scenario 1: Simple Tablix with static columns that render set of rows

The following is the expected tablix output:
image
Given: The columns “Hiring Month”,”Name”,”Department” are static columns
Then: we can achieve alternate row coloring by setting all rows cell property “BackgroundColor” to “=iif(RowNumber(Nothing) mod 2,"White","Gray")

RunningValue Function

Before starting the next scenario I would like to have a little peek about the RunningValue function which returns running aggregate values for an expression within scope let’s have an example to make things more clear

Given that we have a data table with columns “HiringMonth”, “HiredCount”, “Department” that is rendered in tablix like the following image

image

The first 3 columns is mapped directly from the DataTable
Column “Count”
Value: =RunningValue(Fields!HiredCount.Value,count,Nothing)
Description: this column contains the accumulated number of rows from the table till the current row so as we can see the first row is 1,second row we used 2 rows so count equals 2 ,…..

Column “Count Distinct”
Value:

=RunningValue(Fields!HiredCount.Value,countdistinct,Nothing)
Description: this contains the accumulated distinct count of HiredCount column i.e. this value is the result of calling the SQL statement “select count(distinct hiredcount) from table” till the current so we will find row 1 value equals 1,row 2 equals 2,row 3 equals 3 and row 4 equals 3 because this is distinct and row 2 value is 2 so the result still 3 ,…

Column “Summation”
Value: is =RunningValue(Fields!HiredCount.Value,sum,Nothing)
Description: the accumulated summation of the HiredCount column till the current running row
Row 1 = 10
Row 2 = Row1+2 = 10
Row3 = Row2+1 = 13

Scenario 2: Tablix with static columns and contains row grouping

The following image contains the expected output:
image
Given: the columns “HiringMonth”, “Name”, “Department” are static columns and we have group on the column “HiringMonth”
Then: we can achieve alternate row coloring by setting all rows cell property “BackgroundColor” to “=iif(RunningValue(Fields!HiringMonth.Value ,countdistinct,"table1") mod 2,"LightGrey","Gray")

Scenario 3: Tablix with dynamic columns and contains row grouping

Scenario 3.1
The first column is row group on column HiringMonth, the rest of the columns is dynamic
image

Scenario 3.2
The first column is row group on column HiringMonth columns .Net and Java is column group on column Department the sub columns “Male Count” and “Female Count” is static columns inside the department column group
image

To achieve alternate row coloring for the previous scenario we will do the following steps

  1. Add column to your query to hold number of dynamic columns for example “NumberOfColumns”
  2. Create Report Variable “DynamicColumnsCount” with value equals to the total number of columns inside the row
    Scenario 3.1
    Value = The Number of the columns defined in the previous step + 1
    Value = “=Fields!NumberOfColumns.Value + 1”
    Value = 2 + 1  = 3
    Scenario 3.2
    Value = ( Number of Dynamic Columns defined in previous step * Static Columns inside the Dynamic Columns (Male Count, Female Count) + Static Columns (Hiring Month)
    Value = (Fields!NumberOfColumns.Value * 2 ) + 1
    Value = (2 * 2)+ 1 = 5
  3. Define 2 static variables
    rowStatus: this variable will hold either “Even” or “Odd” which represent if we are in even or odd row so we can alternate row color
    Counter: this variable will hold the accumulated number of rendered cells
  4. Define function called ToggleRowStatus which toggle the value of static variable rowStatus from Even to Odd and vice versa
    Public Function ToggleRowStatus() As String
    If rowStatus = "Even" Then
    rowStatus = "Odd"
    Else
    rowStatus = "Even"
    End If
    Return rowStatus
    End Function
  5. Define function called GetRowStatus which accept the number of dynamic columns defined in step 2
       Public Function GetRowStatus(columnCount As Integer) As String
    If Counter Mod columnCount = 0 Then
    ToggleRowStatus()
    End If
    Counter = Counter + 1
    Return rowStatus
    
    End Function
  6. Update the BackgroundColor property of all row cells to “=iif(Code.GetRowStatus(Variables!DynamicColumnsCount.Value)="Even","LightGrey","Grey")”by setting this property, the function GetRowStatus will be called with rendering each cell incrementing the counter and toggling its value in case counter mode columns count equals zero

The following is the full report code

 Public Shared rowStatus As String = "Even"

Public Shared Counter As Integer = 0

Public Function GetRowStatus(columnCount As Integer) As String
If Counter Mod columnCount = 0 Then
ToggleRowStatus()
End If
Counter = Counter + 1
Return rowStatus

End Function

Public Function ToggleRowStatus() As String
If rowStatus = "Even" Then
rowStatus = "Odd"
Else
rowStatus = "Even"
End If
Return rowStatus
End Function

You can download sample project from here , all you have to do is to change the connection string to a valid connection and test the reports.

Enjoy.

دعاء الحروف الأبجدية

اللهم ارزقـــنـــا
بــالألــف ألــفـــة
و بـالـبــاء بــركــة
و بـالـتــاء تــوبـــة
و بـالـثــاء ثــوابـــاُ
و بالجيـم جـمـالاً
و بالـحـاء حكـمـة
و بـالـخـاء خــيــراً
و بـالــدال دلـيــلاً
و بـالــذال ذكــــاء
و بـالــراء رحـمــة
و بـالـزاي زكــــاة
و بالسين سعادة
و بالشيـن شفـاء
و بالـصـاد صـدقــاً
و بـالـضـاد ضـيــاء
و بالـطـاء طـاعــة
و بـالـظـاء ظـفــراً
و بالعـيـن عـلـمـاً
و بالغـيـن غـنــى
و بـالـفـاء فـلاحــاً
و بالقـاف قنـاعـة
و بالكـاف كـرامـة
و بـالــلام لـطـفـاً
و بالميم موعظـة
و بـالـنــون نــــوراً
و بالـهـاء هـدايــة
و بـــــالـــــواو ودّاً
و بـالـيــاء يـقـيـنـاً
الـلــهـم آمــيــــن يارب العالمين
Categories: Uncategorized Tags:

ASP.NET Client Side Validators API

The following articles explains how to work with ASP.NET validators using client javascript

ASP.NET Validation in Depth
http://msdn.microsoft.com/en-us/library/aa479045.aspx

How to control ASP.NET Validator Controls Client Side validation from JavaScript
http://www.aspdotnetfaq.com/Faq/How-to-control-ASP-NET-Validator-Controls-Client-Side-validation-from-JavaScript.aspx

Script Library for Validator Sample
http://msdn.microsoft.com/en-us/library/aa338815(VS.71).aspx

Categories: ASP.Net Tags:

Releasing .NET Framework Source Code + VS 2008 Debugging Support

Check Scott Guthrie announcement “Releasing the Source Code for the .NET Framework Libraries

Categories: .Net, ASP.Net Tags:

Visual Studio 2005 Service Pack 1

Visual Studio 2005 Service Pack 1 released today and it includes over 70 improvements for common development scenarios includes:

  • New processor support (e.g., Core Duo) for code generation and profiling
  • Performance and scale improvements in Team Foundation Server
  • Team Foundation Server integration with Excel 2007 and Project 2007
  • Tool support for occasionally connected devices and SQL Server Compact Edition
  • Additional support for project file based Web applications
  • Windows Embedded 6.0 platform and tools support

    Go and download from the following link but take care because it will take a lot of time to install it http://msdn.microsoft.com/vstudio/support/vs2005sp1/default.aspx

  • Categories: Uncategorized Tags:

    Running IE6 and IE7 side-by-side

    The following is a great tool that enable us to run IE6 and IE7 side-by-side which enable web developers to test web systems
    http://tredosoft.com/Multiple_IE

    Categories: Uncategorized Tags:

    WebPart with Rounded Corners

    Yesterday I was playing with asp.net 2.0 webparts and like anyone I wanted to do webparts like msn spaces where each webpart has a cool header with rounded corners.I have spend some time trying to figure out where the webpart is rendered and finally I found that the WebPartZone class uses WebPartChrome object to render all the webparts inside it also I found the following links which is a great source to learn how implement custom WebPartChrome

    Custom WebPartChrome
    Developing Custom WebPartZoneBase Controls

    Categories: ASP.Net Tags:

    Welcome !

    Hello !

    This will be my personal blog to share my news and technical issues.

    Categories: Uncategorized Tags: