As per your refer link below.
After Changed from
@Html.DropDownListFor(m => m.CodeItem, Model.ItemList)
to
@Html.DropDownList("ddlitem", Model.ItemList)
it value is not inserting into database.
@model WebApplication9.Models.Bigbalprd
@{
Layout = null;
}
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/css/select2.min.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/js/select2.min.js"></script>
<script type="text/javascript">
$(function () {
$("#ddlitem").select2();
});
</script>
<meta name="viewport" content="width=device-width" />
<title></title>
</head>
<body>
<h1>Insert Data Into Data using MVC EDO</h1>>
<div>
@using (Html.BeginForm("Index", "Bigbale", FormMethod.Post))
{
<table border="1" bgcolor="yellow" width="400px" height="250px">
<tr>
<td>Class</td>
<td>@Html.DropDownListFor(m => m.CodeItem, Model.ItemList ,"ddlitem")
@*@Html.DropDownList("ddlitem", Model.ItemList)*@</td>
</tr>
<tr>
<td>Class</td>
<td>@Html.DropDownListFor(m => m.SecID, Model.SectionList)</td>
</tr>
<tr>
<td>Category</td>
<td>@Html.DropDownListFor(m => m.CID, Model.SectionList)</td>
</tr>
<tr>
<td>Qty</td>
<td>@Html.TextBoxFor(m => m.Bpqty)</td>
</tr>
<tr>
<td>Qty</td>
<td>@Html.TextBoxFor(m => m.Bweight)</td>
</tr>
<tr>
<td><input class="submit" type="submit" /></td>
</tr>
</table>
}
</div>
<b>@ViewBag.saveresult</b>
</body>
</html>