yeah..the above solution given by sandeep is rt..I have done such type of a requirement.