It is narrated from Sayyiduna Anas (may Allah be pleased with him) that the Noble Prophet (peace and blessings be upon him) said: "When the Imam says «سَمِعَاللّٰهُلِمَنْحَمِدَهُ», you should say «رَبَّنَاوَلَكَالْحَمْدُ»."
Hadith Referenceسنن دارمي / من كتاب الصللاة / 1347