Monday, January 4, 2010

How to debug Windows service

In web apps we generally press F5 or attach the process for debugging but what to do when it comes to Windows services ???

You"ll come across docs which tell you to do loads of steps for that, but I prefer the most easy way ;)

The process of attaching debugger can be done in just ONE simple line. Use

System.Diagnostics.Debugger.Launch()

The Launch() is a static method of Debugger class. It initializes the debugger.

Now where to put this line ?? Well I prefer in the OnStart() of the Windows service which acts as a starting point of the service.

So you are all set with debugging the Windows service. Happy Debugging :)

How to disable the default progress image of Infragistics webgrid

Hi, today I faced a unique challenge and that was to disable the default progress image on the Infragistics webgrid. Now if you try to sort the column by clicking on its header you see a small image in the middle of the grid...thats the progress image am talking about.

In my case the requirement was to show a custom progress-bar image, so I had to disable the default one.
Heres what I did.

1. Call a method from the InitializeLayout() of the grid on the server-side
Eg:- e.Layout.ClientSideScript.InitializeLayoutHandler =

2. Now the method signature in this case takes two arguments by default, thats comes pre-defined from Infragistics. The first parameter is the grid-name and the second is the columnID. So if your method name is DisableImage, then its signature in the javascript file will look like this

function DisableImage(gridName, colID)
{ }

3. Now what code should I use ??? This is the most important part. Use the code below as-is and your problem is solved

var oGrid = igtbl_getGridByID(gridName);
oGrid.DisableProgressIndicator();

Wholla done !!!!