Graphitic carbon nitride (g-C3N4) used in this work was obtained by heating dicyandiamide and melamine, respectively, at different temperatures. The differences of g-C3N4 derived from different precursors in phase composition, functional group, surface morphology, microstructure, surface property, band gap and specific surface area were investigated by X-ray diffraction, Fourier transform infrared spectroscopy, scanning electron microscopy, transmission electron microscopy, X-ray photoelectron spectroscopy, UV-visible diffuse reflection spectroscopy and BET surface area analyzer, respectively. The photocatalytic discoloration of an active cationic dye, Methylene Blue (MB) under visible-light irradiation indicated that g-C3N4 derived from melamine at 500°C (CN-M500) had higher adsorption capacity and better photocatalytic activity than that from dicyandiamide at 500°C (CN-D500), which was attributed to the larger surface area of CN-M500. MB discoloration ratio over CN-M500 was affected by initial MB concentration and photocatalyst dosage. After 120 min reaction time, the blue color of MB solution disappeared completely. Subsequently, based on the measurement of the surface Zeta potentials of CN-M500 at different pHs, an active anionic dye, Methyl Orange (MO) was selected as the contrastive target pollutant with MB to reveal the synergic effect between adsorption and photocatalysis. Finally, the photocatalytic mechanism was discussed.