In an aspect, described herein is a dynamically controllable optoelectronic smart window which utilizes a diffraction grating for selective transmission or rejection of a specific region of the electromagnetic spectrum, for example the infrared, near-infrared and/or visible regions. Window embodiments described herein may further utilize a selectively controlled and/or patterned total internal reflection layer to assist with the selective rejection of a specific spectral region while allowing for transmission of another specific spectral region. In another aspect, the present invention provides methods for dynamically controlling the transmission or rejection of solar near-infrared and/or visible radiation.