Thursday, January 22, 2015

Asp.net Closing child windows from JavaScript

These maybe situations where we use some of the additional information displayed  using window.open() method. It can cause issue if we keep these open widows when dealing with different user logins within the system.

The solution is to store all opened windows in an Javascript array and close them on logout or navigation to other links or menu options.

 var openWindows = new Array();

function OpenWindow(url){
          
            openWindows.push(window.open(url));
        }


We can use the window.onbeforeunload event to close the opened windows as shown below.

   window.onbeforeunload = function () {
            closeWindows();
        };


 function closeWindows() {
            for (i = 0; i < openWindows .length; i++) if (openWindows [i] && !openWindows[i].closed)
                openWindows[i].close();
        }

Cheers
Samitha

Friday, January 16, 2015

SQL Server check nemeric

There can be situations where you want to check whether a field is a numeric or not. SQL Server provides ISNUMERIC() function to achieve that purpose as shown below.


SELECT case when IsNumeric(cmp) = 1
       then cast(cmp as int)
       else 0 end   FROM Transactions)

This can be easily included in a where clause as follows

select * from Transactions 
where (case when IsNumeric(cmp) = 1
       then cast(
cmp as int)
       else 0 end) >= 7

 
Cheers
Samitha

Friday, December 19, 2014

Easy clipboard management tool for .Net

Ditto is an extension to the standard windows clipboard. It saves each item placed on the clipboard allowing you access to any of those items at a later time.

Read more and download

Cheers
Samitha

Monday, November 10, 2014

Linq Distinct By

When development with LINQ it seems that some of the essential methods is not provided. Morelinq comes into the aid of developers by providing bunch of those valuable methods.

download MoreLink

cheers

Samitha