title: How to conditionally display HTML in MVC?
body: <p>I am trying to show specific HTML in my page depending of IF conditions, I have a static variable to determine the status of the page and what to show, the problem is that after the first page load, no more html is rendered.</p>
  
  <p>This is one of my if :</p>
  
  <pre><code>   @if (WhiteLabel.Controllers.GlobalVariables.Step == 2)
              {
                  &lt;text&gt;
              &lt;div id="thirdDiv" data-step="3" class="no-show"&gt;
                  &lt;div class="span6"&gt;
  </code></pre>
  
  <p>I have a button to change the value of the global variable like :</p>
  
  <pre><code>&lt;form  action="UploadPhoto/setNext" method="post"&gt;
                                  &lt;button class="btn" type="submit"&gt;siguiente&lt;/button&gt;
                              &lt;/form&gt;
  </code></pre>
  
  <p>And it goes to this controller's method :</p>
  
  <pre><code>public ActionResult setNext()
          {
              if (GlobalVariables.Step &lt; 3)
              {
                  GlobalVariables.Step  += 1;
              }
              else
              {
                  RedirectToAction("AdjustDots", "VirtualTesterController");
              }
              return View("Load");
          }
  </code></pre>
  
  <p><strong>UPDATE FULL CODE :</strong></p>
  
  <pre><code>    @if (WhiteLabel.Controllers.GlobalVariables.Step == 1)
      {
     &lt;div id="firstDiv" data-step="1" &gt;
          &lt;!-- SUBIR FOTO --&gt;
          &lt;div class="row-fluid"&gt;
              &lt;div class="span3"&gt;
                  &lt;div class="md-your-data"&gt;
                      &lt;div class="hd"&gt;
                      &lt;h2&gt;1. @ViewBag.Strings["completarDatos"]&lt;/h2&gt;
                      &lt;/div&gt;
                      &lt;div class="bd"&gt;
                          &lt;ul&gt;
                              &lt;li&gt;
                                  &lt;div class='selectBox'&gt;
                                  &lt;span class='selected' id="ageSelected"&gt;@ViewBag.Strings["rangoEdad"]&lt;/span&gt;
                                      &lt;span class='selectArrow'&gt;&lt;/span&gt;
                                      &lt;div class="selectOptions"&gt;
                                          &lt;span class="selectOption" value="Option 1"&gt;Option 1&lt;/span&gt;
                                          &lt;span class="selectOption" value="Option 2"&gt;Option 2&lt;/span&gt;
                                          &lt;span class="selectOption" value="Option 3"&gt;Option 3&lt;/span&gt;
                                      &lt;/div&gt;
                                  &lt;/div&gt;
                              &lt;/li&gt;
                              &lt;li&gt;
                                  &lt;div class='selectBox'&gt;
                                  &lt;span class='selected' id="skinToneSelected"&gt;@ViewBag.Strings["tonoPiel"]&lt;/span&gt;
                                      &lt;span class='selectArrow'&gt;&lt;/span&gt;
                                      &lt;div class="selectOptions"&gt;
                                          &lt;span class="selectOption" value="Option 1"&gt;Option 1&lt;/span&gt;
                                          &lt;span class="selectOption" value="Option 2"&gt;Option 2&lt;/span&gt;
                                          &lt;span class="selectOption" value="Option 3"&gt;Option 3&lt;/span&gt;
                                      &lt;/div&gt;
                                  &lt;/div&gt;
                              &lt;/li&gt;
                              &lt;li&gt;
                                  &lt;div class='selectBox'&gt;
                                  &lt;span class='selected' id="skinTypeSelected"&gt;@ViewBag.Strings["tipoPiel"]&lt;/span&gt;
                                      &lt;span class='selectArrow'&gt;&lt;/span&gt;
                                      &lt;div class="selectOptions"&gt;
                                          &lt;span class="selectOption" value="Option 1"&gt;Option 1&lt;/span&gt;
                                          &lt;span class="selectOption" value="Option 2"&gt;Option 2&lt;/span&gt;
                                          &lt;span class="selectOption" value="Option 3"&gt;Option 3&lt;/span&gt;
                                      &lt;/div&gt;
                                  &lt;/div&gt;
                              &lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/div&gt;
                      &lt;div class="ft"&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div class="span3"&gt;
                  &lt;div class="md-upload-photo"&gt;
                      &lt;div class="hd"&gt;
                      &lt;h2&gt;2. @ViewBag.Strings["SubiTuFoto"]&lt;/h2&gt;
                      &lt;/div&gt;
                      &lt;div id="pictureDiv" class="bd"&gt;
                          &lt;div id="dropPicture" class="photo-cont no-photo" ondragover="allowDrop(event)" ondrop="onDrop(event)"&gt;
                              &lt;div id="picDiv"&gt;&lt;/div&gt;
                          &lt;/div&gt;
  
                      &lt;/div&gt;
                      &lt;div class="ft"&gt;
                          &lt;div class="file-input-wrapper"&gt;
                              &lt;button class="btn-file-input"&gt;@ViewBag.Strings["subir"]&lt;/button&gt;
                              &lt;input id='file' class="btn-file" type='file' accept="image/*" onchange="manageFilePicker(event)" /&gt;
                          &lt;/div&gt;
  
                          @using (Html.BeginForm("setNext", "UploadPicture"))
                          {
                               &lt;button class="btn"  type="submit"&gt;Siguiente&lt;/button&gt;
                          }
  
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div class="span6"&gt;
                  &lt;div class="md-model-photo"&gt;
                      &lt;div class="hd"&gt;
                      &lt;h2&gt;@ViewBag.Strings["Elegirfotodemodelo"] &lt;/h2&gt;
                      &lt;/div&gt;
                      &lt;div class="bd"&gt;
                          &lt;ul id="modelsList"&gt;
                              &lt;li&gt;
                                  &lt;img src="~/Content/images/imagen-modelo-upload.png" alt="" /&gt;
                              &lt;/li&gt;
                              &lt;li&gt;
                                  &lt;img src="~/Content/images/imagen-modelo-upload.png" /&gt;
                                  &lt;img src="~/Content/images/imagen-modelo-upload.png" alt="" /&gt;
                              &lt;/li&gt;
                              &lt;li&gt;
                                  &lt;img src="~/Content/images/imagen-modelo-upload.png" alt="" /&gt;
                              &lt;/li&gt;
                              &lt;li&gt;
                                  &lt;img src="~/Content/images/imagen-modelo-upload.png" alt="" /&gt;
                              &lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/div&gt;
                      &lt;div class="ft"&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
          &lt;/div&gt;
          &lt;!-- END SUBIR FOTO --&gt;
         &lt;/div&gt;
      }
  
  
        @if (WhiteLabel.Controllers.GlobalVariables.Step &gt; 2)
      {
      &lt;div class="row-fluid"&gt;
          &lt;!-- BEGIN MANAGE PHOTO --&gt;
  
          &lt;div id="secondDiv" data-step="2" class="no-show"&gt;
              &lt;div class="span6"&gt;
                  &lt;div class="md-adjust-photo-img"&gt;
                      &lt;div class="bd"&gt;
                          &lt;div class="img-cont"&gt;
                              &lt;img src="~/Content/images/img-modelo.png" alt="" /&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
               @if (WhiteLabel.Controllers.GlobalVariables.Step == 2)
               {
              &lt;div id="thirdDiv" data-step="3" class="no-show"&gt;
                  &lt;div class="span6"&gt;
                      &lt;div class="md-adjust-photo-data step-1"&gt;
                          &lt;div class="hd"&gt;
                          &lt;h3&gt;4. @ViewBag.Strings["encuadrarFoto"]&lt;/h3&gt;
                          &lt;p&gt;@ViewBag.Strings["encuadrarFotoDesc"]&lt;/p&gt;
                          &lt;/div&gt;
                          &lt;div class="bd"&gt;
                          &lt;/div&gt;
                          &lt;div class="ft"&gt;
                              @using (Html.BeginForm("setPrevious", "UploadPicture"))
                              {
                                  &lt;button class="btn" type="submit"&gt;Atras&lt;/button&gt;
                              }
                              @using (Html.BeginForm("setNext", "UploadPicture"))
                              {
                                  &lt;button class="btn" type="submit"&gt;Siguiente&lt;/button&gt;
                              }
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
               }
               @if (WhiteLabel.Controllers.GlobalVariables.Step == 3)
               {
              &lt;div id="fourthDiv" data-step="4" class="no-show"&gt;
                  &lt;div class="span6"&gt;
                      &lt;div class="md-adjust-photo-data step-2"&gt;
                          &lt;div class="hd"&gt;
                  &lt;h3&gt;5. @ViewBag.Strings["brilloYcontraste"]&lt;/h3&gt;
                  &lt;p&gt;@ViewBag.Strings["brilloYcontrasteDesc"]&lt;/p&gt;
                          &lt;/div&gt;
                          &lt;div class="bd"&gt;
                              &lt;div class="col"&gt;
                      &lt;span&gt;@ViewBag.Strings["brightness"]&lt;/span&gt;
                                  &lt;div class="tone-bar"&gt;
                                      &lt;span&gt;&lt;/span&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                              &lt;div class="col"&gt;
                      &lt;span&gt;@ViewBag.Strings["contrast"]&lt;/span&gt;
                                  &lt;div class="tone-bar"&gt;
                                      &lt;span&gt;&lt;/span&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class="ft"&gt;
                              @using (Html.BeginForm("setPrevious", "UploadPicture"))
                              {
                                  &lt;button class="btn" type="submit"&gt;Atras&lt;/button&gt;
                          }
                              @using (Html.BeginForm("setNext", "UploadPicture"))
                              {
                                  &lt;button class="btn" type="submit"&gt;Siguiente&lt;/button&gt;
                          }
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
               }
          &lt;/div&gt;
      &lt;/div&gt;
  
      }
  </code></pre>