title: ASP.NET MVC Show div after validation
body: <p>So i'm doing a wizard as such located here: 
  <a href="https://stackoverflow.com/questions/297148/how-to-make-a-wizard-with-asp-net-mvc">how to make a wizard with ASP.Net MVC</a>
  where each page has its own div but each div is really located on the same page.  Now, there are 2 issues...I am new to MVC and wish to do some sort of validation before continuing to the next page.  Validation ranges from a simple text box (is there data there?) to is the data in the textbox in the correct format, to is there an item in the drop down list selected, to is there an item in a listbox (mutually exclusive listboxes).  So there is a wide range of variety going on, including a few pages will have tables with paging/sorting where the user will select an item from the list and click to modify that item or add a new one so, it will depend on what the user does on the first page to populate the rest of the pages, if necessary.  Now, I have tried this:</p>
  
  <pre><code>public ActionResult ContinueToCorr(string Number, string Rev)
      {
  
          ViewData["DivIsVisible"] = true;
          return RedirectToAction("../Wizard/Index/1");
      }
  </code></pre>
  
  <p>located from here <a href="https://stackoverflow.com/questions/936146/set-div-visible-fasle-in-get-method-of-controller">set div visible fasle in get method of controller</a> yet it doesn't work for me.  </p>
  
  <p>Also, I'd like to do the following and I would greatly appreciate any help.  Before the user starts the wizard, Id like the user to be presented with a selection page (obviously) then after selection, Id like the web address to be something like this 
  localhost:xxxx/Wizard/'PartNumber'/'PageNumberOfWizard' so if the user is selected part number 12345 and started the wizard, they would be redirected to localhost:xxxx/Wizard/12345/1 (for page 1) and localhost:xxxx/Wizard/12345/2 for page 2 and so on with each page showing the next div and hiding the previous after successful validation.  </p>
  
  <p>Finally, I tried to play with the asax file for routing in order to get what I wanted before in a web address but this is what I came up with:</p>
  
  <pre><code>routes.MapRoute(
              "Wizard",                                              // Route name
              "Wizard/{PartNum}/{PageId}",                           // URL with parameters
              new { controller = "Wizard", action = "Index" }  // Parameter defaults
          );
  </code></pre>
  
  <p>So it looks as if It will always call the Index method of the Wizard controller.  </p>
  
  <p>Now I have tried the following in my View pages:</p>
  
  <pre><code>&lt;% Html.BeginForm("ContinueToPage", "Wizard", FormMethod.Post); %&gt;
                          &lt;div class="span-87 buttons"&gt;
                              &lt;input type="submit" value="Continue" name="button" /&gt;
                          &lt;/div&gt;
                      &lt;% Html.EndForm(); %&gt;
  </code></pre>
  
  <p>Surrounding each button in a form to call a new specific function for that button to start the validation process before continuing onto the next page and the code behind would look like this:</p>
  
  <pre><code>[AcceptVerbs(HttpVerbs.Post)]
      public ActionResult ContinueToCorr(string Number, string Rev)
      {
          //if (String.IsNullOrEmpty(Number))
          //    ModelState.AddModelError("Number", "Number is required");
          //if (String.IsNullOrEmpty(TPSSWRevision))
          //    ModelState.AddModelError("Rev", "Revision is required");
          //if (!ModelState.IsValid)
          //    return View();
  
          ViewData["DivIsVisible"] = true;
          return RedirectToAction("../Wizard/Index/1");
      }
  </code></pre>
  
  <p>I'm not sure if thats entirely correct but I just feel as if I am running in circles here.  Thanks a lot.  Sorry if its so long but I wanted to make it as detailed as possible.  Also, I have included this:</p>
  
  <pre><code>&lt;script runat="server"&gt;
  protected bool DivIsVisible {
      get {
          return ViewData["DivIsVisible"] != null &amp;&amp; (bool)ViewData["DivIsVisible"];
      }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>in the View as well, still nothing.</p>