I have my kendo.grid using the grideditmode.popup for creating and editing. My foreign key values show fine in the grid and also on an edit in the drop downs. But they won't add the actual values into the db. So I add a new row and pick the two items in the two drop downs and they remain null in the db. If I edit one where they are null, they stay null. If I edit one where they aren't null and change the values, that works fine. Any ideas are appreciated.
columns.ForeignKey(item => item.InstructorID, (IEnumerable<
PointsInfrastructure.Instructor
>)ViewData["instructorList"], "InstructorID", "Name");
columns.ForeignKey(item => item.SchoolID, (IEnumerable<
PointsInfrastructure.School
>)ViewData["schoolList"], "SchoolID", "Name");
[Display(Name = "Instructor")]
[UIHint("GridForeignKey")]
public long? InstructorID { get; set; }
[Display(Name = "School")]
[UIHint("GridForeignKey")]
public long? SchoolID { get; set; }
// create new tournament
var listValue = new Competitor()
{
MemberID = inViewModel.MemberID,
LastName = inViewModel.LastName,
FirstName = inViewModel.FirstName,
MemberNumber = inViewModel.MemberNumber,
DateOfBirth = inViewModel.DateOfBirth,
InstructorID = inViewModel.InstructorID,
SchoolID = inViewModel.SchoolID,
Email = inViewModel.Email,
Sex = inViewModel.Sex,
Notes = inViewModel.Notes
};
_db.Competitors.Add(listValue);
_db.SaveChanges();