Skip to content
Loading
The OnPost you already have
+1
  • Marius Vasile
    +1
    I have the same error
     
    An unhandled exception occurred while processing the request.
    SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_HazIds_OrgPTWs_PTWNo". The conflict occurred in database "aspnet-RoSafety-53bc9b9d-9d6a-45d4-8429-2a2761773502", table "dbo.OrgPTWs", column 'PTWNo'.
    The statement has been terminated. 
    +1
  • Marius Vasile
    +1
    I got it figuered out, there was no value for hidden input field
     
    1. @Html.HiddenFor(model => model.OrgPTW, new { Value = "@OrgPTW.PTWNo" })  
     
     syntax was wrong. correct one
    1. for="HazId.PTWNo" [email protected] />  
    and then redirection
    1. return RedirectToPage("PTWNew", "PTWNoId", new { ptwNoId = newHazId.PTWNo });  
    ...and it is working properly. Thank you Sachin for your efforts 
    +1