Abhay,
its strange that even after getting the solution, instead of closing the thread you tend to take it to a different loop!! Pls respect the people who have been taking time to make you understand and writing on your thread. Pls close this now and raise a separate thread for other requirement. Also there are ample resources in the internet to meet your requirement, you can easily check.
best regds
Subha