A polyimminium gel, Dimedone-[N, N′ melaminium] butyrocarboxylate copolymer, comprising of zwitterionic carboxybetaine repeat units was synthesized via a catalyst free facile polycondensation approach. The polymer was studied for its photoluminescence, thermal, and swelling behavior. Swelling behavior was investigated in different solvent mixtures as well as in pure solvents. The extent of swelling was dictated by solvent composition, such as dielectric constant, pH, ionic strength, and other variables for instance, temperature and crosslinking density. Gel was soluble in alkali and could be regenerated on treatment with an acid. This pH responsive behavior could find various industrial applications, especially in wastewater treatment. A preliminary study on sorption of dyes was also carried out. © 2011 Wiley Periodicals, Inc. J Appl Polym Sci, 2011.