This work reports the photo-alignment effect in a liquid-crystal film doped with nanoparticles and azo-dye. Vertical alignment induced by the nanoparticles polyhedral oligomeric silsesquioxanes (POSS) can be switched to homogeneous alignment by the absorption of photo-excited azo-dye. Both electro-optical and surface properties are analyzed to verify this effect. Using this photo-alignment technique in nanoparticle- and azo-dye-doped liquid crystal, the phase grating is also demonstrated. The diffraction efficiency is related to the polarization of the probe light and can be controlled by applying voltage. Both nanoparticle- and azo-dye-induced vertical and homogeneous alignments are non-contact aligning methods. Thus, the technique based on dopant-induced alignment has potential for practical applications.