This was my fix.
I rendered a partial view
Main View
<div class="asideRight">
<fieldset>
<legend></legend>
@Html.Partial("_AddCat", new Exercise4.Models.Category())
</fieldset>
</div>
Partial View
@model Exercise4.Models.Category
<script src="~/Scripts/jquery-1.7.1.min.js"></script>
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
@using (Html.BeginForm("addCat", "Quote")) {
@Html.ValidationSummary(true)
<fieldset>
<legend class="myLegend">Create New Category</legend>
<div class="editor-field">
@Html.EditorFor(model => model.CatName)
</div>
<p>
<input class="mySubmit" type="submit" value="Create" />
</p>
</fieldset>
<div class="myValidation">
@Html.ValidationMessageFor(model => model.CatName)
@Html.ValidationMessage("")
</div>
}
This allowed me to post back to the controller and add the new category before returning to the Create View
Controller Method
[HttpPost]
[Authorize]
public ActionResult addCat(Category cat)
{
if (cat.CatName != null)
{
bool exists = db.Categories.Any(n => n.CatName.ToLower() == cat.CatName.ToLower());
if (!exists)
{
db.Categories.Add(cat);
db.SaveChanges();
}
else
{
ModelState.AddModelError("", "You entered a duplicate Category Name");
}
}
ViewBag.CategoryID = new SelectList(db.Categories.OrderBy(n => n.CatName), "CategoryID", "CatName");
return RedirectToAction("Create");
}