Hi
you can find the answer for your post in a detailed manner in the following link
http://www.developerfusion.co.uk/show/2516/