It was narrated form 'Amir bin Rabi'ah Al-'Adawi that the Messenger of Allah said:
"When you see a funeral, stand up until it has passed you, or (the body) is placed (in the grave)."
أَخْبَرَنَا قُتَيْبَةُ، قَالَ حَدَّثَنَا اللَّيْثُ، عَنِ ابْنِ شِهَابٍ، عَنْ سَالِمٍ، عَنْ أَبِيهِ، عَنْ عَامِرِ بْنِ رَبِيعَةَ الْعَدَوِيِّ، عَنْ رَسُولِ اللَّهِ صلى الله عليه وسلم أَنَّهُ قَالَ
" إِذَا رَأَيْتُمُ الْجَنَازَةَ فَقُومُوا حَتَّى تُخَلِّفَكُمْ أَوْ تُوضَعَ "
.