When your child was a baby and you saw toddlers shrieking, slapping and ignoring their parents, you probably swore to yourself that you'd never let your kid get away with that. Now that you have a toddler of your own, you might feel like trying to get him to behave is like trying to herd hyperactive cats. No magic bullet can get your toddler to mind you (alas!), but some techniques for promoting good behavior work better than others.
Keep your child out of settings that invite misbehavior. Taking your child to a friend's house that hasn't been child-proofed is asking for trouble as is trying to go anywhere when your child is hungry or tired, or having a favorite toy available when other children are coming over and will want to play with it.
Model good behavior yourself. You've probably already heard that spanking your child or slapping her hand will teach her to solve problems through violence. In the same way, you'll send mixed signals if you yell at your child to stop yelling or grab something out of her hand and then expect her not to be grabby. Remaining calm and civil even when you feel like tearing your hair out will show your child to be calm and civil as well.
Praise your toddler whenever you see him behaving well: Say "Thank you for sharing your truck with your brother!" or "Good job touching the kitty gently!" Your child craves your praise and attention and responds to it more readily than to scolding. You might end up feeling like a broken record as your toddler turns to you with an expectant smile after putting every individual block back in the toy box, but keep it up.
Redirect inappropriate behavior by telling your toddler how she can do a similar activity in an acceptable way. For instance, if your child is thwacking the coffee table with a toy, say, "Don't hit the table. If you want to hit something, let's play with your drum." You might need to bring the drum over to her in order to distract her from the fun of banging her doll against the table. Eventually, your toddler will figure out that if she's in the mood to whale away on something, the drum is the right toy to hit.
Make any punishment you give fit the crime. For instance, if he keeps throwing his chocolate milk on the floor, give him water instead and make him help you to wipe up the spilled milk. If your child understands the consequences of misbehaving, he'll be more likely to connect the idea of bad behavior to the idea of punishment.
Keep your expectations of "good behavior" realistic for your child's age. If you have a 2-year-old, he's going to go through phases of stubbornness and saying "no." It's frustrating, but punishing him every time he says "no" is punishing him for being 2 years old. Save it for times when he's saying "no" about important things such as "No, I won't hold your hand when I cross the street." For everything else, grit your teeth and wait for the phase to pass.