We report an optofluidic photoswitchable grating, based on a polydimethylsiloxane periodic structure on a glass substrate, separated by a thin liquid crystal film. The polydimethylsiloxane microstructure was realized via high resolution replica molding and was employed to both confine and align a photosensitive nematic liquid crystal. In the absence of any surface treatment, the liquid crystal exhibited homeotropic alignment. By inducing planar alignment on the glass substrate, a hybrid orientation of the liquid crystal was achieved, inducing polarization sensitive transmission. The photosensitivity of the liquid crystal enabled the all-optical control of the grating transmission and 20% diffraction efficiency was measured. © 2010 American Institute of Physics.