title: Save a Value outside of Dropdownlist EF6
body: <p>I wish to save an id field called AssetAssignmentID the value of "2" everytime a new modelname is saved.</p>
  
  <p>I was looking to see if i could do the following; </p>
  
  <p>That was if the Modelname was not null, then save both the ModelName and AssetAssignmentID to = "2"</p>
  
  <pre><code>  public ActionResult Create(ClinicalAsset clinicalAssets)
      {
  
  
          try
          {
  
              if (ModelState.IsValid)
          {
  
                  if (clinicalAssets.ModelName != null)
                  {
                      clinicalAssets.ModelName = clinicalAssets.ModelName;
                      clinicalAssets.AssetAssignmentID = "2";
  
  
                  }
  
  
                  db.ClinicalAssets.Add(clinicalAssets);
                  db.SaveChanges();
                  return RedirectToAction("Details", "ClinicalAssets", new { ClinicalAssetID = clinicalAssets.ClinicalAssetID });
              }
      }
  </code></pre>
  
  <p>However it complains that an object reference is required for non-static field. 
  If I make reference to the AssetAssignmentID in the ClinicalAsset Model  I cannot convert type int to Model.  </p>
  
  <p><strong>The populated dropdownlist</strong></p>
  
  <pre><code>private void PopulateModelDropDownList(object selectedModel = null)
          {
              var ModelsQuery = from d in db.Models.Where(x =&gt; x.AssetAssignmentID == 2) orderby d.ModelName select d;
              ViewBag.ModelDropDown = new SelectList(ModelsQuery, "ModelID", "ModelName", selectedModel);
          }
  </code></pre>
  
  <p>I would expect that every time a new ModelName is submitted to the database the AssetAssignmentID would always equal the value of two.</p>
  
  <p><strong>edit</strong></p>
  
  <p>I have also tried </p>
  
  <pre><code>
                        var clinicalAsset = new ClinicalAsset { AssetAssignmentID = 2 };
  
                      if (clinicalAssets.ModelName != null)
                      {
                          clinicalAssets.ModelName = clinicalAssets.ModelName;
  
                      }
  
  
                      db.ClinicalAssets.Add(clinicalAsset);
                      db.SaveChanges();
                      return RedirectToAction("Details", "ClinicalAssets", new { ClinicalAssetID = clinicalAssets.ClinicalAssetID });
  
  </code></pre>
  
  <p>but the error is:   Cannot implicitly convert type 'int' to 'Assets.Models.Model'   </p>
  
  <p><strong>ClinicalAsset Model:</strong></p>
  
  <pre><code>using Assets.Models;
  using System;
  using System.Collections.Generic;
  using System.ComponentModel.DataAnnotations;
  
  namespace Assets.Areas.Clinical.Models
  {
      public class ClinicalAsset
      {
  
          [Key]
          public int ClinicalAssetID { get; set; }
          public int AssetTypeID { get; set; }
          public int? ProductID { get; set; }
          public int? ManufacturerID { get; set; }
          public int? ModelID{ get; set; }
          public int? SupplierID { get; set; }
          [StringLength(100, MinimumLength = 2)]
          public string SerialNo { get; set; }
          [DataType(DataType.Date)]
          [DisplayFormat(DataFormatString = "{0:dd/MM/yy}", ApplyFormatInEditMode = true)]
          public DateTime? PurchaseDate { get; set; }
          [StringLength(100, MinimumLength = 2)]
          public string PoNo { get; set; }
          [DisplayFormat(DataFormatString = "{0:c2}", ApplyFormatInEditMode = true)]
          public decimal? Costing { get; set; }
          public int? TeamID { get; set; }
          public int? BudgetCodeID { get; set; }
          public int? StaffID { get; set; }
          public bool? Filter { get; set; }
  
  
  
          public virtual Model ModelName { get; set; }
          public virtual Model AssetAssignmentID { get; set; }
          public virtual BudgetCode BudgetCodeJoinColumn { get; set; }
          public virtual Product ProductName { get; set; }
          public virtual AssetType AssetTypeName { get; set; }
          public virtual Manufacturer ManufacturerName { get; set; }
          public virtual Staff StaffName { get; set; }
          public virtual Team TeamName { get; set; }
          public virtual Supplier SupplierName { get; set; }
  
          public virtual ICollection&lt;ClinicalPAT&gt; ClinicalPATs { get; set; }
  
  
  
      }
  }
  </code></pre>
  
  <p><strong>Models</strong> model</p>
  
  <pre><code>namespace Assets.Models
  {
      public class Model
      {
  
          [Key]
          public int ModelID { get; set; }
          public int AssetAssignmentID { get; set; }
          public string ModelName { get; set; }
  
      }
  }
  </code></pre>
  
  <p><strong>Create Form:</strong></p>
  
  <pre><code>@model Assets.Areas.Clinical.Models.ClinicalAsset
  &lt;link href="~/Content/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css" /&gt;
  @{
      ViewBag.Title = "Create Asset";
      ViewBag.Current = "Create Asset";
  }
  
  
  &lt;div class="pageheader"&gt;
      &lt;h2&gt;&lt;i class="fa fa-pencil"&gt;&lt;/i&gt;Add Clinical Assets&lt;/h2&gt;
      &lt;div class="breadcrumb-wrapper"&gt;
          &lt;span class="label"&gt;You are here:&lt;/span&gt;
          &lt;ol class="breadcrumb"&gt;
              &lt;li&gt;Asset Management System&lt;/li&gt;
              &lt;li class="active"&gt;Clinical Assets / Add Asset&lt;/li&gt;
          &lt;/ol&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="contentpanel"&gt;
  @using (Html.BeginForm())
  {
      @Html.AntiForgeryToken()
  
  
  
          &lt;div class="col-md-6"&gt;
              &lt;div class="panel panel-default"&gt;
                  &lt;div class="panel-heading"&gt;
                      &lt;div class="panel-btns"&gt;
                          &lt;a href="" class="minimize"&gt;&amp;minus;&lt;/a&gt;
                      &lt;/div&gt;
                      &lt;h4 class="panel-title"&gt;Create an asset.&lt;/h4&gt;
                      &lt;p&gt;Please fill in the required boxes as a minimum.&lt;text style="color:red;"&gt; * &lt;/text&gt; &lt;/p&gt;
                  &lt;/div&gt;
                  @Html.ValidationSummary()
                  &lt;div class="panel-body"&gt;
                      &lt;div class="row"&gt;
                          &lt;div class="col-sm-6"&gt;
                              &lt;div class="form-group"&gt;
                                  @Html.LabelFor(model =&gt; model.AssetTypeID, "Asset Type:", new { @class = "control-label" })
                                  @Html.DropDownListFor(model =&gt; model.AssetTypeID, (SelectList)ViewBag.AssetTypeDropDown, "Please Select From The List", new { @class = "form-control" })
                                  @Html.ValidationMessageFor(model =&gt; model.AssetTypeID, "", new { @class = "text-danger" })
                              &lt;/div&gt;
                          &lt;/div&gt;&lt;!-- col-sm-6 --&gt;
  
                          &lt;div class="col-sm-6"&gt;
                              &lt;div class="form-group"&gt;
                                  &lt;label id="lbltipAddProduct"&gt;Select Product:&lt;/label&gt; &lt;label id="lbltipAddProduct2" style="display:none;"&gt;Enter Product:&lt;/label&gt;   
                                  &lt;label id="hideproductbutton" style="float: right;"&gt;&lt;i class="myClass fa fa-edit" id="product"&gt;&lt;/i&gt;&lt;/label&gt;
                                  &lt;label id="shownewproductbutton" Style="float: right; display:none;"&gt;&lt;i class="glyphicon glyphicon-remove-circle" id="product2"&gt;&lt;/i&gt;&lt;/label&gt;
                                  &lt;div id="Product"&gt;
                                      @Html.DropDownListFor(model =&gt; model.ProductID, (SelectList)ViewBag.ProductDropDown, "Please Select From The List", new { @class = "form-control" })
                                      @Html.ValidationMessageFor(model =&gt; model.ProductID, "", new { @class = "text-danger" })
                                  &lt;/div&gt;
                                  &lt;div class="js-product" style="display:none;"&gt;
                                      @Html.EditorFor(model =&gt; model.ProductName.ProductName, new { htmlAttributes = new { @class = "form-control", @placeholder = "Enter Product Name Here", disabled = "disabled" } })
                                      @Html.ValidationMessageFor(model =&gt; model.ProductName.ProductName, "", new { @class = "text-danger" })
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;&lt;!-- col-sm-6 --&gt;
                      &lt;/div&gt;&lt;!-- row --&gt;
                      &lt;div id="inputs-for-filters1"&gt;
  
                          &lt;div class="form-group"&gt;
                              @Html.EditorFor(model =&gt; model.Filter)
                              @Html.LabelFor(model =&gt; model.Filter, "Filter Required?")
                              @Html.ValidationMessageFor(model =&gt; model.Filter)
                          &lt;/div&gt;
  
                      &lt;/div&gt;
                      &lt;div id="inputs-for-filters2"&gt;
  
                          &lt;div class="form-group"&gt;
                              @Html.EditorFor(model =&gt; model.Filter)
                              @Html.LabelFor(model =&gt; model.Filter, "Filter Required?")
                              @Html.ValidationMessageFor(model =&gt; model.Filter)
                          &lt;/div&gt;
  
                      &lt;/div&gt;
                      &lt;div class="row"&gt;
                          &lt;div class="col-sm-6"&gt;
                              &lt;div class="form-group"&gt;
                                  &lt;label id="lbltipAddManufacturer"&gt;Select Manufacturer:&lt;/label&gt; &lt;label id="lbltipAddManufacturer2" style="display:none;"&gt;Enter Manufacturer:&lt;/label&gt;   
                                  &lt;label id="hidemanufacturerbutton" style="float: right;"&gt;&lt;i class="myClass fa fa-edit" id="manufacturer"&gt;&lt;/i&gt;&lt;/label&gt;
                                  &lt;label id="shownewmanufacturerbutton" Style="float: right; display:none;"&gt;&lt;i class="glyphicon glyphicon-remove-circle" id="manufacturer2"&gt;&lt;/i&gt;&lt;/label&gt;
                                  &lt;div id="Manufacturer"&gt;
                                      @Html.DropDownListFor(model =&gt; model.ManufacturerID, (SelectList)ViewBag.ManufacturerDropDown, "Please Select From The List", new { @class = "form-control" })
                                      @Html.ValidationMessageFor(model =&gt; model.ManufacturerID, "", new { @class = "text-danger" })
                                  &lt;/div&gt;
                                  &lt;div class="js-manufacturer" style="display:none;"&gt;
                                      @Html.EditorFor(model =&gt; model.ManufacturerName.ManufacturerName, new { htmlAttributes = new { @class = "form-control", @placeholder = "Enter Name Here", disabled = "disabled" } })
                                      @Html.ValidationMessageFor(model =&gt; model.ManufacturerName.ManufacturerName, "", new { @class = "text-danger" })
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;&lt;!-- col-sm-6 --&gt;
                          &lt;div class="col-sm-6"&gt;
                              &lt;div class="form-group"&gt;
                                  &lt;label id="lbltipAddModel"&gt;Select Model:&lt;/label&gt; &lt;label id="lbltipAddModel2" style="display:none;"&gt;Enter Model Type:&lt;/label&gt;  
                                  &lt;label id="hidemodelbutton" style="float: right;"&gt;&lt;i class="myClass fa fa-edit" id="model"&gt;&lt;/i&gt;&lt;/label&gt;
                                  &lt;label id="shownewmodelbutton" Style="float: right; display:none;"&gt;&lt;i class="glyphicon glyphicon-remove-circle" id="model2"&gt;&lt;/i&gt;&lt;/label&gt;
                                  &lt;div id="Model"&gt;
                                      @Html.DropDownListFor(model =&gt; model.ModelID, (SelectList)ViewBag.ModelDropDown, "Please Select From The List", new { @class = "form-control" })
                                      @Html.ValidationMessageFor(model =&gt; model.ModelID, "", new { @class = "text-danger" })
                                  &lt;/div&gt;
                                  &lt;div class="js-model" style="display:none;"&gt;
                                      @Html.EditorFor(model =&gt; model.ModelName.ModelName, new { htmlAttributes = new { @class = "form-control", @placeholder = "Enter Name Here", disabled = "disabled" } })
                                      @Html.ValidationMessageFor(model =&gt; model.ModelName.ModelName, "", new { @class = "text-danger" })
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;&lt;!-- col-sm-6 --&gt;
                      &lt;/div&gt;&lt;!-- row --&gt;
                          &lt;div class="row"&gt;
                              &lt;div class="col-sm-6"&gt;
                                  &lt;div class="form-group"&gt;
                                      &lt;label id="lbltipAddSupplier"&gt;Select Supplier:&lt;/label&gt; &lt;label id="lbltipAddSupplier2" style="display:none;"&gt;Enter Supplier:&lt;/label&gt;  
                                      &lt;label id="hidesupplierbutton" style="float: right;"&gt;&lt;i class="myClass fa fa-edit" id="supplier"&gt;&lt;/i&gt;&lt;/label&gt;
                                      &lt;label id="shownewsupplierbutton" Style="float: right; display:none;"&gt;&lt;i class="glyphicon glyphicon-remove-circle" id="supplier2"&gt;&lt;/i&gt;&lt;/label&gt;
                                      &lt;div id="Supplier"&gt;
                                          @Html.DropDownListFor(model =&gt; model.SupplierID, (SelectList)ViewBag.SupplierDropDown, "Please Select From The List", new { @class = "form-control" })
                                          @Html.ValidationMessageFor(model =&gt; model.SupplierID, "", new { @class = "text-danger" })
                                      &lt;/div&gt;
                                      &lt;div class="js-supplier" style="display:none;"&gt;
                                          @Html.EditorFor(model =&gt; model.SupplierName.SupplierName, new { htmlAttributes = new { @class = "form-control", @placeholder = "Enter Supplier Name Here", disabled = "disabled" } })
                                          @Html.ValidationMessageFor(model =&gt; model.SupplierName.SupplierName, "", new { @class = "text-danger" })
                                      &lt;/div&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;&lt;!-- col-sm-6 --&gt;
                              &lt;div class="col-sm-6"&gt;
                                  &lt;div class="form-group"&gt;
                                      @Html.LabelFor(model =&gt; model.SerialNo, "Serial No:", new { @class = "control-label" })
                                      @Html.EditorFor(model =&gt; model.SerialNo, new { htmlAttributes = new { @class = "form-control" } })
                                      @Html.ValidationMessageFor(model =&gt; model.SerialNo, "", new { @class = "text-danger" })
                                  &lt;/div&gt;
                              &lt;/div&gt;&lt;!-- col-sm-6 --&gt;
                          &lt;/div&gt;&lt;!-- row --&gt;
                          &lt;div class="row"&gt;
                              &lt;div class="col-sm-6"&gt;
                                  &lt;div class="form-group"&gt;
                                      @Html.LabelFor(model =&gt; model.PurchaseDate, "Purchase Date:", new { @class = "control-label" })
                                      @Html.TextBoxFor(m =&gt; m.PurchaseDate, new { @class = "form-control datepicker", autocomplete = "off" })
                                      @Html.ValidationMessageFor(model =&gt; model.PurchaseDate, "", new { @class = "text-danger" })
                                  &lt;/div&gt;
                              &lt;/div&gt;&lt;!-- col-sm-6 --&gt;
                              &lt;div class="col-sm-6"&gt;
                                  &lt;div class="form-group"&gt;
                                      @Html.LabelFor(model =&gt; model.PoNo, "Purchase OrderNo:", new { @class = "control-label" })
                                      @Html.EditorFor(model =&gt; model.PoNo, new { htmlAttributes = new { @class = "form-control" } })
                                      @Html.ValidationMessageFor(model =&gt; model.PoNo, "", new { @class = "text-danger" })
                                  &lt;/div&gt;
                              &lt;/div&gt;&lt;!-- col-sm-6 --&gt;
                          &lt;/div&gt;&lt;!-- row --&gt;
                          &lt;div class="row"&gt;
                              &lt;div class="col-sm-6"&gt;
                                  &lt;div class="form-group"&gt;
                                      @Html.LabelFor(model =&gt; model.BudgetCodeID, "Budget Code:", new { @class = "control-label" })
                                      @Html.DropDownListFor(m =&gt; m.BudgetCodeID, (SelectList)ViewBag.BudgetsList, "Please Select From The List", new { @class = "form-control" })
                                      @Html.ValidationMessageFor(model =&gt; model.BudgetCodeID, "", new { @class = "text-danger" })
                                  &lt;/div&gt;
                              &lt;/div&gt;&lt;!-- col-sm-6 --&gt;
                              &lt;div class="col-sm-6"&gt;
                                  &lt;div class="form-group"&gt;
                                      @Html.LabelFor(model =&gt; model.Costing, "Cost:", new { @class = "control-label" })
                                      @Html.EditorFor(model =&gt; model.Costing, new { htmlAttributes = new { @class = "form-control" } })
                                      @Html.ValidationMessageFor(model =&gt; model.Costing, "", new { @class = "text-danger" })
                                  &lt;/div&gt;
                              &lt;/div&gt;&lt;!-- col-sm-6 --&gt;
                          &lt;/div&gt;&lt;!-- row --&gt;
                          &lt;div class="row"&gt;
                              &lt;div class="col-sm-6"&gt;
                                  &lt;div class="form-group"&gt;
                                      @Html.LabelFor(model =&gt; model.TeamID, "Team:", new { @class = "control-label" })
                                      @Html.DropDownListFor(model =&gt; model.TeamID, ViewBag.TeamList as SelectList, "Please Select From The List", new { @class = "form-control" })
                                      @Html.ValidationMessageFor(model =&gt; model.TeamID, "", new { @class = "text-danger" })
                                  &lt;/div&gt;
                              &lt;/div&gt;&lt;!-- col-sm-6 --&gt;
                              &lt;div class="col-sm-6"&gt;
                                  &lt;div class="form-group"&gt;
                                      &lt;label id="lbltipAddStaff"&gt;Select Staff Member:&lt;/label&gt; &lt;label id="lbltipAddStaff2" style="display:none;"&gt;Enter Staff Member Name:&lt;/label&gt;   
                                      &lt;label id="hidestaffbutton" Style="float: right;"&gt;&lt;i class="myClass fa fa-edit" id="staff"&gt;&lt;/i&gt;&lt;/label&gt;
                                      &lt;label id="shownewstaffbutton" Style="float: right; display:none;"&gt;&lt;i class="glyphicon glyphicon-remove-circle" id="staff2"&gt;&lt;/i&gt;&lt;/label&gt;
                                      &lt;div id="Staff"&gt;
                                          @Html.DropDownListFor(model =&gt; model.StaffID, (SelectList)ViewBag.StaffDropDown, "Please Select From The List", new { @class = "form-control" })
                                          @Html.ValidationMessageFor(model =&gt; model.StaffID, "", new { @class = "text-danger" })
                                      &lt;/div&gt;
                                      &lt;div class="js-staff" style="display:none;"&gt;
                                          @Html.EditorFor(model =&gt; model.StaffName.StaffName, new { htmlAttributes = new { @class = "form-control", @placeholder = "Enter Name Here", disabled = "disabled" } })
                                          @Html.ValidationMessageFor(model =&gt; model.StaffName.StaffName, "", new { @class = "text-danger" })
                                      &lt;/div&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;&lt;!-- col-sm-6 --&gt;
                          &lt;/div&gt;&lt;!-- row --&gt;
                      &lt;/div&gt;&lt;!-- panel-body --&gt;
  
                  &lt;div class="panel-footer"&gt;
                      &lt;input type="submit" value="Create" class="btn btn-primary" /&gt;
                  &lt;/div&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
      }
  &lt;/div&gt;&lt;!-- panel --&gt;
  
  @section Scripts {
      &lt;script src="~/Scripts/jquery-ui-1.10.3.min.js"&gt;&lt;/script&gt;
      &lt;script src="~/Scripts/jquery.unobtrusive-ajax.js"&gt;&lt;/script&gt;
  
          @Scripts.Render("~/bundles/jqueryval")
  
      &lt;script&gt;
  
          // Date Picker
          jQuery('#PurchaseDate').datepicker({ dateFormat: 'dd/mm/yy' });
          jQuery('#WarrantyEndDate').datepicker({ dateFormat: 'dd/mm/yy' });
          jQuery('#InspectionDate').datepicker({ dateFormat: 'dd/mm/yy' });
          jQuery('#InspectionDueDate').datepicker({ dateFormat: 'dd/mm/yy' });
          jQuery('#datepicker-inline').datepicker();
  
          jQuery('#datepicker-multiple').datepicker({
              numberOfMonths: 3,
              showButtonPanel: true
          });
  
  
  
          $(document).ready(function () {
              $("#inputs-for-filters1").hide();
              $("#inputs-for-filters2").hide();
  
              $("#AssetTypeID").change(function () {
                  if ($("#AssetTypeID").val() == "3") {
                      $("#inputs-for-filters1").show();
                  }
                  else {
                      $("#inputs-for-filters1").hide();
                  }
              });
  
              $("#ProductID").change(function () {
                  if ($("#ProductID").val() == "24") {
                      $("#inputs-for-filters2").show();
                  }
                  else {
                      $("#inputs-for-filters2").hide();
                  }
              });
  
          });
  
  
  
              $(document).ready(function () {
                  $("#staff").click(function () {
                      $("#Staff").toggle();
                      $(".js-staff").toggle();
                      $('#lbltipAddStaff').toggle();
                      $('#lbltipAddStaff2').toggle();
                      $(".js-staff input[type='text']").attr("disabled", false);
                      $("#hidestaffbutton").toggle();
                      $("#shownewstaffbutton").toggle();
                  });
              });
  
              $(document).ready(function () {
                  $("#staff2").click(function () {
                      $("#Staff").toggle();
                      $(".js-staff").toggle();
                      $('#lbltipAddStaff').toggle();
                      $('#lbltipAddStaff2').toggle();
                      $(".js-staff input[type='text']").attr("disabled", true);
                      $("#hidestaffbutton").toggle();
                      $("#shownewstaffbutton").toggle();
                  });
              });
  
              $(document).ready(function () {
                  $("#model").click(function () {
                      $("#Model").toggle();
                      $(".js-model").toggle();
                      $('#lbltipAddModel').toggle();
                      $('#lbltipAddModel2').toggle();
                      $(".js-model input[type='text']").attr("disabled", false);
                      $("#hidemodelbutton").toggle();
                      $("#shownewmodelbutton").toggle();
                  });
              });
  
              $(document).ready(function () {
                  $("#model2").click(function () {
                      $("#Model").toggle();
                      $(".js-model").toggle();
                      $('#lbltipAddModel').toggle();
                      $('#lbltipAddModel2').toggle();
                      $(".js-model input[type='text']").attr("disabled", true);
                      $("#hidemodelbutton").toggle();
                      $("#shownewmodelbutton").toggle();
                  });
              });
  
              $(document).ready(function () {
                  $("#manufacturer").click(function () {
                      $("#Manufacturer").toggle();
                      $(".js-manufacturer").toggle();
                      $('#lbltipAddManufacturer').toggle();
                      $('#lbltipAddManufacturer2').toggle();
                      $(".js-manufacturer input[type='text']").attr("disabled", false);
                      $("#hidemanufacturerbutton").toggle();
                      $("#shownewmanufacturerbutton").toggle();
                  });
              });
  
  
              $(document).ready(function () {
                  $("#manufacturer2").click(function () {
                      $("#Manufacturer").toggle();
                      $(".js-manufacturer").toggle();
                      $('#lbltipAddManufacturer').toggle();
                      $('#lbltipAddManufacturer2').toggle();
                      $(".js-manufacturer input[type='text']").attr("disabled", true);
                      $("#hidemanufacturerbutton").toggle();
                      $("#shownewmanufacturerbutton").toggle();
                  });
              });
  
              $(document).ready(function () {
                  $("#product").click(function () {
                      $("#Product").toggle();
                      $(".js-product").toggle();
                      $('#lbltipAddProduct').toggle();
                      $('#lbltipAddProduct2').toggle();
                      $(".js-product input[type='text']").attr("disabled", false);
                      $("#hideproductbutton").toggle();
                      $("#shownewproductbutton").toggle();
                  });
              });
  
              $(document).ready(function () {
                  $("#product2").click(function () {
                      $("#Product").toggle();
                      $(".js-product").toggle();
                      $('#lbltipAddProduct').toggle();
                      $('#lbltipAddProduct2').toggle();
                      $(".js-product input[type='text']").attr("disabled", true);
                      $("#hideproductbutton").toggle();
                      $("#shownewproductbutton").toggle();
                  });
              });
  
  
              $(document).ready(function () {
                  $("#supplier").click(function () {
                      $("#Supplier").toggle();
                      $(".js-supplier").toggle(); 
                      $('#lbltipAddSupplier').toggle();
                      $('#lbltipAddSupplier2').toggle();
                      $(".js-supplier input[type='text']").attr("disabled", false);
                      $("#hidesupplierbutton").toggle();
                      $("#shownewsupplierbutton").toggle();
                  });
              });
  
              $(document).ready(function () {
                  $("#supplier2").click(function () {
                      $("#Supplier").toggle();
                      $(".js-supplier").toggle();
                      $('#lbltipAddSupplier').toggle();
                      $('#lbltipAddSupplier2').toggle();
                      $(".js-supplier input[type='text']").attr("disabled", true);
                      $("#hidesupplierbutton").toggle();
                      $("#shownewsupplierbutton").toggle();
                  });
              });
  
  
  
      &lt;/script&gt;
  }
  
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I now have the AssignmentID saving as 2, but it creates a new entry in the database rather than assigning two values to the same field</p>