iMac 2011 with MacBook Air 2010
To use Target Display mode with a Thunderbolt equipped iMac you need another Thunderbolt equipped Mac and a Thunderbolt cable [emphasis is mine]:


  iMac (21.5-inch, Mid 2011) and iMac (27-inch, Mid 2011) support Target Display Mode via Thunderbolt to Thunderbolt cable (2 m) when the source is another Thunderbolt-equipped computer.


Source: iMac (Mid 2011): Target Display Mode does not work with Mini DisplayPort cable

If your MacBook Air has Mini DisplayPort then it will not work. More here about what options will work.