title: Automatic icon selector according to the file i selected in <a href> tag
body: <p>I wonder how could I improve these code that it will automatically recognize file in the folder "/Doc/Projekti/&lt;%=dat%>" and chose the right icon from "/Img/image.png". In this folder, I have icons for pdf, xls, word,... 
  All these icons are in png format. Here is my code I currently using but on all files that code find is  now pdf icon</p>
  
  <pre><code>&lt;%  
      string adresa = (string)Application["naslov"];
      string adresa1 = adresa + "doc\\Projekti";
      var t=2;
      DirectoryInfo info = new DirectoryInfo(adresa1);
      FileInfo[] files = info.GetFiles().OrderByDescending(p =&gt; p.CreationTime).ToArray();
      foreach (FileInfo dat in files){
          var test=dat;
          if(test.ToString() != "Thumbs.db"){
  
      %&gt;
  &lt;a  href="/Doc/Projekti/&lt;%=dat%&gt;" style="color:#6c8230; padding: 0 0 10px 10px; text-decoration: none;" target="_blank"&gt;&lt;img src="/Img/pdf.png" style="border: 0px" alt="PDF"&gt;&lt;%=dat%&gt;&lt;/a&gt;&lt;BR&gt;
  </code></pre>