It was narrated from Thawban that:The Messenger of Allah said: "No one among the Muslims should stand to pray when he is suppressing (the need to urinate or defecate), until he has to relieve himself
Hadith No. 619
Sunan Ibn Majah
Gradings:
Al-Albani:
Daif
Muhammad Fouad Abd al-Baqi:
Sahih
Shuaib Al Arnaut:
Sahih Lighairihi
Zubair Ali Zai:
Hasan