Why is it not good to sleep in the trousers? Are you kidding? Of course, it`s not alright! Unless your trousers are a part of pajamas
It will be ok if you are sleeping in a tent or other building for wilderness. But at home, we should sleep in underwear.