"Children are not always angels" and that too when they misbehave and embarrass you in front your guests.
When a child makes a mistake and that too in front of others, we get embarrassed and that embarassment makes us get angry and say unwanted things. We most probably react the wrong way. You should just stay calm and not get carried away by the circumstances. It would be better for you to keep quiet there and then after coming back home the child should be told that he is not supposed to do that. Beating or punishing the kids in front of others make you as well as the child embarrassed. Punishment could be given after you reach home. A little punishment there and the remaining at home will not help. For any given mistake one punishment is enough and we should not keep on repeating the same, then it becomes nagging.
You should learn to be calm and collected during times like these and show your children that you will not get swayed or disturbed by their misbehaviour. Mostly it will be just to show their spite at you. They know very well that you will get upset when they misbehave in front of your guests. You have to avoid yelling and screaming at the children, since this can teach your child that it is all right to lose control if you don't get your way. They will also end up doing the same at one time or the other when you least expect them to. You have to show that you are unhappy with their behaviour and let know that you will always love him even when you punish them for their misbehaviour.
Like wise you have to avoid too much praise on your children and that too in front of others. You don't need to be continuously praising your child, especially for routine activities, because it will make your comments less effective. I have seen parents who keep telling others how good their child is, the child is so active and knowledgeable, in front of their children and the children start thinking too much about themselves. You can tell the children when they do the work they are asked to and say just Thank you very much . They will also start saying the same to their friends too.
We cannot expect our children to do what we ourselves do not do. If we can show them and behave how we want our child to behave, they will pick up the cues from us and behave like a role model to the other kids.