title: Selected item list and other object
body: <p>I'm new in asp.net mvc3 programming and I'm trying to build a specific form. I need to have a form with the user field (which I have) but also a list of object (in that case SStatus).</p>
  
  <hr>
  
  <p><strong>My form :</strong> </p>
  
  <pre><code>@using (Html.BeginForm()) {
      @Html.ValidationSummary(true)
      &lt;fieldset&gt;
          &lt;legend&gt;Création d'utilisateur&lt;/legend&gt;
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Lastname)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.Lastname)
              @Html.ValidationMessageFor(model =&gt; model.Lastname)
          &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Firstname)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.Firstname)
              @Html.ValidationMessageFor(model =&gt; model.Firstname)
          &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Email)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.Email)
              @Html.ValidationMessageFor(model =&gt; model.Email)
          &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Login)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.Login)
              @Html.ValidationMessageFor(model =&gt; model.Login)
          &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Description)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.Description)
              @Html.ValidationMessageFor(model =&gt; model.Description)
          &lt;/div&gt;
  
          &lt;p&gt;Status&lt;/p&gt;
          @{
  </code></pre>
  
  <p>//The error was form here
                  </p>
  
  <pre><code>                @{
                      var list = ViewBag.listStatus as List&lt;SStatus&gt;;
                  }
                  @if (list != null)
                  {
                      foreach(var status in list)
                      {
                          &lt;option value=@status.ID&gt;@status.Name&lt;/option&gt; 
                      }
                  }
              &lt;/select&gt;
          }
  
          &lt;p&gt;
              &lt;input type="submit" value="Création" /&gt;
          &lt;/p&gt;
      &lt;/fieldset&gt;
  }
  </code></pre>
  
  <p><strong>The list call :</strong></p>
  
  <hr>
  
  <pre><code>public ActionResult CreateUserView()
          {
              RestClient client = new RestClient(Resource.Resource.LocalUrlService);
              RestRequest request = new RestRequest("/status/all", Method.GET);
              var response = client.Execute(request);
              if(response.StatusCode == HttpStatusCode.OK)
              {
                  List&lt;SStatus&gt; listSatus = JsonHelper.FromJson&lt;List&lt;SStatus&gt;&gt;(response.Content);
                  ViewBag.listStatus = listSatus;
              }
              return View();
          }
  </code></pre>
  
  <p><strong>And the form post:</strong></p>
  
  <hr>
  
  <pre><code>     [HttpPost]
              public ActionResult CreateUserView(Uuser userToCreate, string list)
              {
  //list got the ID of SStatus. 
                  if (ModelState.IsValid)
                  {//Stuff}
      }
  </code></pre>
  
  <p>So the question is :  How get the selected list item ? </p>
  
  <p>Regards.</p>