There are a few issues in your code -
In your controller, make sure you are passing an instance of the 'GetCustomerMasterFileTbl' model to the view instead of 'AddCustomerMasterFileTbl'.
Replace the line -
@model CustomerService.Data.odel.AddCustomerMasterFileTbl
to -
@model GetCustomerMasterFileTbl
In your HTML Modal View, update the 'TextBoxFor' expressions to bind to the correct properties of the model -
L-Name*
@Html.TextBoxFor(m => m.LastName,
new { @class = "form-control", required = "required" })
F-Name*
@Html.TextBoxFor(m => m.FirstName,
new { @class = "form-control", required = "required" })
Initial
@Html.TextBoxFor(m => m.MiddleName,
new { @class = "form-control", required = "required" })
B-Date *
@Html.TextBoxFor(m => m.BirthDate,
"{0:yyyy-MM-dd}",
new { @class = "form-control", placeholder = "yyyy-MM-dd", required = "required", type = "date" })
In the controller action 'GetCustomerMasterFile', make sure you're returning the correct model -
var model = new GetCustomerMasterFileTbl
{
CustomerMasterFileJVM = CodeListing,
CustomerIDno = CodeListing.FirstOrDefault()?.CustomerIDno,
LastName = CodeListing.FirstOrDefault()?.LastName,
FirstName = CodeListing.FirstOrDefault()?.FirstName,
MiddleName = CodeListing.FirstOrDefault()?.MiddleName,
BirthDate = CodeListing.FirstOrDefault()?.BirthDate,
Gender = CodeListing.FirstOrDefault()?.Gender,
CustomerAddress = CodeListing.FirstOrDefault()?.CustomerAddress,
ContactPerson = CodeListing.FirstOrDefault()?.ContactPerson,
ContactNumber = CodeListing.FirstOrDefault()?.ContactNumber,
CustomerEmail = CodeListing.FirstOrDefault()?.CustomerEmail,
CreatedBy = CodeListing.FirstOrDefault()?.CreatedBy
};
return View(model);