Car jerking violently and losing power while on motion

  mercedes/b-class/2005-2011

The other day my Mercedes B180 just suddenly jerked and then lost power despite `I trying to press the gas a bit.  Then a message came on the dash saying that "Transmission problem, please visit a workshop".  After that, I slowed down, eased off the road and switched it off and on.  It then just moved well to the house.

Next day, it was jerking again.  What could be the problem?

19