We have developed a fabrication procedure for growing photonic crystals in the lithographic defined microchannels, which enables easy integration with other planar optical components. This technique is based on the directed evaporation induced self-assembly of nanoparticles in the microchannels. Substrates with pre-patterned microchannels (30-100 μm wide) were dipped into solution of nanoparticles for several days. By controlling the evaporation rate, the meniscus contacting the microchannels will undergo evaporation-induced self-assembly. The capillary forces cause nanospheres to crystallize within the microchannels forming colloidal photonic crystals in the microchannels. Two types of colloidal particles, polystyrene and silica, have been employed to fabricate colloidal photonic crystals in the microchannels. Both types of colloidal particles were found to form large-area well-ordered colloidal single crystals in the microchannels. The optical reflection spectra from the (111) surfaces of the colloidal crystals formed by various sizes of nanoparticles have been measured. And the measured reflection peaks agree with the photonic bandgap calculated by the plane wave expansion method.