King Ambareesh was the ruler of Sripuram. He had a beautiful daughter, Srimathi. He wished to get her married to anyone of her wish. Srimathi prayed to Lord Vishnu to marry her.
The king announced the date for swayamvara ceremony (ceremony that allows a bride to choose her groom).
Saint Narada and one other saint (name not sure) were also tempted by the announcement. Both went in person to Maha Vishnu and seeked his blessings. But both were unaware of the other's visit to Vaikuntam (the holy abode of vishnu). They prayed to Vishnu for his blessings and also asked the other person's face to get changed to a monkey's face at the time of swayamvara. Vishnu granted the boons to them.
The swayamvara started. Both Narada and the other person's face transformed to a monkey face. Srimathi saw Lord Vishnu at the swayamvara and selected Him as her husband. The marriage ceremony was over. Vishnu granted salvation to the devotee Srimathi. Both the saints were having grudge on Vishnu as he failed their attempts. They went to Vaikuntam and cursed Vishnu that one day or the other, He will suffer from the separation from His wife and will need to seek the help of monkeys.
Vishnu told them why he did like that. He said to them that being a saint, they should not get desires like marrying. He transformed their face to make them realise its wrong on their part to get married.
The saints realised their mistakes and told Vishnu that they had cursed him and it is impossible to get that curse back. Vishnu said, "Let it be one of the reason for the rAmA avatAr".