My toddler has a stomach bug. The doctor said he could have diarrhea for up to 2 weeks. Will he be contagious until all of his symptoms go away?

Oral vs stool . The infectiousness of a stomach bug varies. The oral secretions are likely contagious until a day or so after the fever is gone. The virus can remain active in the stool for 6 weeks.( normal hygenic practices prevent spread).
Generally. Depending upon the particular virus present it will be shed in the stool for the duration of the illness and individuals who may be contaminated by the stool (hand to mouth, or to food, etc.), may become infected.
Yes. Yes but no more contagious than the common cold. If you practice universal precautions, with good hand hygiene, little contact with face and mouth (kinda hard in toddlers) he should resume normal schedule and activities when he is feeling up to it. Make sure you keep him well hydrated.