An ionic liquid based polymer, poly(1-ethyl-3-(acryloyloxy)hexylimidazolium iodide) (PEAI), was synthesized and employed as electrolyte to fabricate all-solid-state dye-sensitized solar cells. The photophysical properties of PEAI were studied by UV-vis absorption spectroscopy and photoluminescence spectroscopy. PEAI exhibited significant hypochromism and red shift in UV-vis absorption spectra and large Stokes shifts in photoluminescence spectra, indicating the formation of a novel p-stacked structure in which the imidazolium rings in the side chain were stacked. Without iodine in its preparation, DSC with PEAI electrolyte achieved a conversion efficiency of 5.29% under AM 1.5 simulated solar light irradiation (100 mW cm À2 ). The side-chain imidazolium p-p stacking in PEAI played a key role in the holes transport from the photoanode to the counter electrode. Both the open-circuit voltage and short-circuit current density showed decreases with the increase in the content of iodine in PEAI electrolyte.