public ActionResult Index(ComplicatedForm model)
 {
     if (ModelState.IsValidEditableFieldsOnly(model))
     {
         return RedirectToAction("Index");
     }
     model.PopulateAllTestDropDownItems();
     return View(model);
 }
 public ActionResult Index(ComplicatedForm model)
 {
     if (ModelState.IsValid)
     {
         TempData.Add("success", "Successfully submitted form!");
         return RedirectToAction("Index");
     }
     model.PopulateAllTestDropDownItems();
     return View(model);
 }
        public ActionResult Index()
        {
            var model = new ComplicatedForm();

            model.ParentItemId =
                model.AllParentItems.Where(_ => _.Text == "Parent 2").Select(_ => Convert.ToInt32(_.Value)).First();
            model.ChildItemId =
                model.AllChildItems.Where(_ => _.ParentValue == model.ParentItemId.ToString() && _.Value != "")
                     .Select(_ => Convert.ToInt32(_.Value))
                     .First();
            model.ChildOfChildItemIds =
                model.AllChildOfChildItems.Where(_ => _.ParentValue == model.ChildItemId.ToString() && _.Value != "")
                     .Take(2)
                     .Select(_ => Convert.ToInt32(_.Value))
                     .ToArray();

            return View(model);
        }