title: Nested if Statement does not follow "map"
body: <p>I have a bit of an issue with some nested if statements. Here is what it looks like:</p>
  <pre><code>if (selectedlocat == &quot;&quot;)
  {
      if (selectedfield == &quot;&quot;)
      {
      }
      else
      {
      }
  }
  else
  {
      if (selectedfield == &quot;&quot;)
      {
      }
      else
      {
      }
  }
  </code></pre>
  <p>It does not follow the &quot;map&quot; correctly. For some reason it always goes to the else statement in the else statement at the bottom. I know this because it gives me an error in that area, when it was never supposed to even get to that part of the code.</p>
  <p>What is going on, and how can I fix it?</p>
  <p>*<em><strong><strong>EDIT</strong></strong></em></p>
  <p>Alright, so let me do a little clarification:</p>
  <p>It is in a razor webpage, so debugging does me no good until I run into the error.</p>
  <p>The values are truly empty, I have a foreach inside of each if and else</p>
  <p>The whole story:</p>
  <p>I have a website in which I get data and I conditionally show it based on what the dropdown form is. the reason I think that it is in the nesting is that I had it working with one dropdown, but when I added the second one, I had to make it conditional. Here is the full code:</p>
  <pre><code>        @{
             if (selectedlocat == &quot;&quot;)
             {
                 if (selectedfield == &quot;&quot;)
                 {
                     foreach (var row1 in db.Query(querypeople + order))
                                      
                      {
                          &lt;tr&gt;
                              &lt;td style=&quot;text-align:center; width: 110px&quot;&gt;@row1.Last_Name, @row1.First_Name &lt;/td&gt;
                              &lt;td&gt;@row1.Firm_Name&lt;/td&gt;
                              &lt;td style=&quot;text-align:center&quot;&gt;&lt;a href=&quot;http://@row1.Website&quot;&gt;@row1.Website&lt;/a&gt;&lt;/td&gt;
                              &lt;td style=&quot;text-align:center&quot;&gt;@row1.Phone_Office&lt;/td&gt;
                              &lt;td style=&quot;text-align:center&quot;&gt;@row1.City_Phys&lt;/td&gt;
                          &lt;/tr&gt;
                      }
                  }
                  else
                  {
                     foreach (var row2 in db.Query(querypeople + where + field + selectedfield + app + order))
                                      
                      {
                          &lt;tr&gt;
                              &lt;td style=&quot;text-align:center; width: 110px&quot;&gt;@row2.Last_Name, @row2.First_Name &lt;/td&gt;
                              &lt;td&gt;@row2.Firm_Name&lt;/td&gt;
                              &lt;td style=&quot;text-align:center&quot;&gt;&lt;a href=&quot;http://@row2.Website&quot;&gt;@row2.Website&lt;/a&gt;&lt;/td&gt;
                              &lt;td style=&quot;text-align:center&quot;&gt;@row2.Phone_Office&lt;/td&gt;
                              &lt;td style=&quot;text-align:center&quot;&gt;@row2.City_Phys&lt;/td&gt;
                          &lt;/tr&gt;
                      }
                 }
  
             }
             else
             {
                 if (selectedfield == &quot;&quot;)
                 {
                     foreach (var row3 in db.Query(querypeople + where + city + selectedlocat + app + order))
                                      
                      {
                          &lt;tr&gt;
                              &lt;td style=&quot;text-align:center; width: 110px&quot;&gt;@row3.Last_Name, @row3.First_Name &lt;/td&gt;
                              &lt;td&gt;@row3.Firm_Name&lt;/td&gt;
                              &lt;td style=&quot;text-align:center&quot;&gt;&lt;a href=&quot;http://@row3.Website&quot;&gt;@row3.Website&lt;/a&gt;&lt;/td&gt;
                              &lt;td style=&quot;text-align:center&quot;&gt;@row3.Phone_Office&lt;/td&gt;
                              &lt;td style=&quot;text-align:center&quot;&gt;@row3.City_Phys&lt;/td&gt;
                          &lt;/tr&gt;
                      }
                  }
                  else
                  {
                      foreach (var row4 in db.Query(querypeople + where + city + selectedlocat + app + and + field + selectedfield + app + order))
                                      
                      {
                          &lt;tr&gt;
                              &lt;td style=&quot;text-align:center; width: 110px&quot;&gt;@row4.Last_Name, @row4.First_Name &lt;/td&gt;
                              &lt;td&gt;@row4.Firm_Name&lt;/td&gt;
                              &lt;td style=&quot;text-align:center&quot;&gt;&lt;a href=&quot;http://@row4.Website&quot;&gt;@row4.Website&lt;/a&gt;&lt;/td&gt;
                              &lt;td style=&quot;text-align:center&quot;&gt;@row4.Phone_Office&lt;/td&gt;
                              &lt;td style=&quot;text-align:center&quot;&gt;@row4.City_Phys&lt;/td&gt;
                          &lt;/tr&gt;
                      }
                  }
           
            }
      }
          &lt;/tbody&gt;
      &lt;/table&gt;
  </code></pre>