Early game, it's not too hard to keep some control over inheritance even in elective gavelkind. What you must absolutely not do, is to have a potential heir raised with diplomacy education. Those with diplo education will almost always be elected. So what I personnaly do is that I raise all of them as military education; this combines well with tribal large desmesne and heavy relisance on troops (raid,...). This way the AI usually have mixed feelings about your heirs, so there are commonly ties beetween several of your sons (or even a son with one less vote) that your vote will be the determining factor.
Once your dynasty grows, it becomes troublesome because even if you raised uncles with martial education, sons get less and less likely to be elected; if other dynasts are landed too, they will educate some of their heirs with diplo education which will overide your decades or centuries of good education.
That was for heir control.
Now for land control:
give lands that you don't want to children that you don't want as heirs. If you feed each enough lands, then whatever is left will be for your chosen heir (giving one duchy with one county within that duchy to each son you don't want as primary heir works well unless you hands out tons of duchies; if you don't have enough duchies for each son then some can do with just counties). If your heir is not a son though, it kind of brakes the whole strategy because he will only inherit your top title while the rest will go to your unlanded non primary heir son. So basically if your demesne will fracture too much at your death, you must start conquering and handing out titles to sons. Always do your best to keep your capital duchy with all counties under your direct control as that one is easily passed upon your main heir integrally upon inheritance (revoke after inheritance if some of your brothers have inherited counties within that duchy).