Hi Team
My save functionality is getting this exception, before all my form fields were saving to my table on DB. 
- // Controller
- public ActionResult SubmitRegDetails(RegViewAndRoleViewModel eNtsaRegistration)
- {
- if(ModelState.IsValid)
- {
- eNtsaRegistration.RegForm.Id = Guid.NewGuid();
- db.eNtsaRegForms.Add(eNtsaRegistration.RegForm);
- db.SaveChanges(); // Throws error here each time want to save changes to DB.
- return RedirectToAction("SaveRegForm");
- }
- // Model
- public class eNtsaRegForm
- {
- [Key]
- public Guid? Id { get; set; }
- public string Title { get; set; }
- public string FirstName { get; set; }
- public string LastName { get; set; }
- public string Position { get; set; }
- public string Company { get; set; }
- public string StreetAddress { get; set; }
- public string StreetAddressLine { get; set; }
- public string City { get; set; }
- public string StateProvince { get; set; }
- public int ZipCode { get; set; }
- public string Country { get; set; }
- [Required(ErrorMessage = " This field is required")]
- [EmailAddress(ErrorMessage = "Invalid email address")]
- public string Email { get; set; }
- public int CellNumber { get; set; }
- public string DietaryRequirements { get; set; }
- }
Jenith ThakkarPosted Jul 23, 2020, 4:06 AM
This error is generated when passed data length is greater then field length
Thank you
Santhakumar MunuswamyPosted Jul 23, 2020, 4:42 AM
Guest UserPosted Jul 23, 2020, 4:28 AM
Santhakumar MunuswamyPosted Jul 23, 2020, 3:58 AM
Laxmidhar SahooPosted Jul 23, 2020, 3:58 AM
Guest UserPosted Jul 23, 2020, 3:25 AM
Santhakumar MunuswamyPosted Jul 22, 2020, 9:22 PM