MVC3-Dropdown - Modellstatusfehler auf HttpPost

Ich erhalte die folgende Fehlermeldung für meine Dropdown-Liste der [HttpPost] -Methode. Die Werte sind richtig verbindlich, das ist kein Problem. Es liegt jedoch immer ein Fehler im Modellstatus vor. Der Fehler ist:

Die Parameterkonvertierung vom Typ 'System.String' zum Typ 'System.Web.Mvc.SelectListItem' ist fehlgeschlagen, da kein Typkonverter zwischen diesen Typen konvertieren kann.

In meinem Modell verwende ich Folgendes.

 public class UploadDocumentViewModel    {



        [Display(Name = "Document Title")]
        public string DocumentTitle { get; set; }  



        public IEnumerable<SelectListItem> FileType { get; set; }

    }

FileTypeViewModel:

 public class FileTypeViewModel
    {
        public string FileTypeId { get; set; }
        public string FileTypeDescription { get; set; }
    }

Im Controller HttpGet

[HttpGet]
        public ActionResult UploadDocument()
        {

            var fileTypes = iFileTypeRepository.GetFileTypes(); // This is for FileType DropDownlist of values


            UploadDocumentViewModel uploadDocumentViewModel = new UploadDocumentViewModel
            {

                FileType = fileTypes.Select(x => new SelectListItem
                {
                    Text = x.FileTypeDescription,
                    Value = Convert.ToString(x.FileTypeId)
                }).ToList()
             };
            return View(uploadDocumentViewModel);

        }

In der [HttpPost] -Methode

public ActionResult UploadDocument(FormCollection form,UploadDocumentViewModel uploadDocumentViewModel )
        {


            //FileTypes
            string ddlFileTypeSelectedValue = Convert.ToString(form["FileType"]);
            var ddlFileType = iFileTypeRepository.GetFileTypes();
            uploadDocumentViewModel.FileType = new SelectList(ddlFileType, "FileTypeId", "FileTypeDescription", ddlFileTypeSelectedValue);        



            // No Errors, then Submit
            if (ModelState.IsValid)
            {
               -- Redirect to some other View
            }

            else
            {
                return View(uploadDocumentViewModel);
            }

        }

Im Hinblick auf

@model xxx.Core.Model.UploadDocumentViewModel
@{
    ViewBag.Title = "Upload Document";
}
<h2>
    Upload Client Document</h2>
@Html.ValidationSummary()
@using (Html.BeginForm("UploadDocument", "Document", "FormMethod.Post"))
{
       <div>
        <fieldset>
            <legend>Upload Client Document</legend>
                 <div class="editor-label">
                  @Html.LabelFor(model => model.DocumentTitle)
                 </div>
                 <div class="demo">
                  @Html.TextBoxFor(model => model.DocumentTitle, new { @id = "txtDocumentTitle" })
                  @Html.ValidationMessageFor(model => model.DocumentTitle)
                  </div>
                   <div>
                      @Html.LabelFor(model => model.FileType)
                   </div>
                    <div>
                      @Html.DropDownListFor(model => model.FileType, Model.FileType, "Please Select", new { @id = "ddlFileType" })

                   </div>
          </fieldset>
               </div>
              <br />       
}
@{Html.EndForm();}

Antworten auf die Frage(1)

Ihre Antwort auf die Frage