Design proposal for passing parameters to MVC

How do you pass parameters to ASP.net MVC through two views, for example, a wizard?

Or what is best?

I am working on moving the ASP.net bug tracking application to MVC, I cannot stagger ASPX from my head and gather in circles.

In an aspx application.

Page1 → Select a project, go through a project in Querystring
Page2 → Select IssueType, pass projectId and Emetype to Querystring
Page3 → Create a new problem, we can get a querystring of projectId and IssueType

How do we recreate the stream described above in MVC?

+3
source share
4 answers

"" <form> .

: , ( ASP.net, :(). , , , , , .

<form action="order-wizard.html" method="POST">
    <!-- which step of the wizard are we on? -->
    <input type="hidden" name="step" value="1" />
    <!-- Get some info from the user for the first step of the wizard -->
    <select name="Model">
        <option value="Sedan">Sedan</option>
        <option value="Coup">Coup</option>
        <option value="Pickup">Pickup</option>
        <option value="Van">Van</option>
    </select>
    <input type="submit" />
</form>

, order-wizard.html , step 1 , . ​​: ( "pickup" )

<form action="order-wizard.html" method="POST">
    <!-- which step of the wizard are we on? -->
    <input type="hidden" name="step" value="2" />
    <!-- Stored results from the previous stage of the wizard -->
    <input type="hidden" name="Model" value="Pickup" />
    <!-- Additional information for the wizard.  More than one option can be
         requested for each stage of the wizard. -->
    <select name="Style">
        <option value="Short Bed">Short Bed</option>
        <option value="Long Bed">Long Bed</option>
        <option value="Extended Cabin">Extended Cabin</option>
        <option value="Dually">Dually</option>
    </select>
    <select name="Interior">
        <option value="Cloth">Cloth</option>
        <option value="Leather"> Leather </option>
    </select>
    <input type="submit" />
</form>

, , . , , , , .

, . , RESTful, , .

, , , , . . , .

+3

TokenMacGuy, .

, , , . , , UpdateModel , , .

, . <MyApp.Controllers.Wizard>.

, :

public class Wizard
{
  string FirstName {get;set;}
  string LastName {get;set;}
  string eMail {get;set;}
}

eMail 2 .

1 FirstName LastName, postback UpdateModel ( Wizard), .

, View 2, , 1. View 2 UpdateModel ( Wizard) 1- 2 , .

FirstName LastName .

, . , , .

JamesShannon . , , - .

, JavaScript , . , , , . <= , .

  <script src="/Scripts/jquery-1.3.2.js"></script>
  <script>
      $(document).ready(function() {

          $("#addComment").click(function() {
          if ($("#divStep2").is(':visible')) {
              $("#divStep2").slideUp(300);
          } else {
          $("#divStep2").slideDown(300);
              }
          });

      });
  </script>

, , . , JS , , , JS, .

, , JS, , , , .

JS , , , , - , , 1/2 .

, .

+4

griegs. , . , , , , - .

... , , , :

a) 3- . ... AJAX. .

b) ... 2 ( ).

0

All Articles