As you said in the comment that:
after submitting the form companyId = null
This is actually becuase your drop down select input field name is CompanyName
instead of CompanyId
So name it CompanyId
as follows:
<div class="form-group">
<strong class="strong">Company Name</strong>
<div class="col-md-10">
@Html.DropDownList("CompanyId", (IEnumerable<SelectListItem>)ViewBag.CompanyName, "Select Company", new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.CompanyId, "", new { @class = "text-danger" })
</div>
</div>
Now CompanyId
will have a value on post.
solved DropdownList value is getting null in ASP.NET MVC