Asp.Net Core MVC Razor View Form not posting data to the Server-Side


Problem: Asp.Net Core MVC Razor View Form not posting data to the Server-Side
Solution:
Make sure that the Modal you are posting to the Server-Side is valid, this includes creating a new Modal Object populated with all the altributes of the Data Modal. 

This is your function(ModalName objectInstance){
//This is a new Object you're trying to create populated by data from http request (posted)
ModalName newName = new ModalName(){
id = objectInstance.id,
anotherDatapropertyName = objectInstance.anotherDatapropertyName,
//Go ahead and create the data modal in here
}
//Now that you have the complete data modal, you can update the database or create a new object.

//Always good to return something to the caller
return View("SomeDataInHere");
}



  • Watch out for "disabled" HTML attributes in the front-end, Asp.Net Core Controller does not like receiving data from a "disabled" HTML control.
  • If the above solution does not help you, make sure that your Model is registered or defined in the Database Context Class.
    - Make sure the Model has a DBSet directive set and has columns defined accurately.

    Update
  • Make sure that the form has enctype="multipart/form-data" if the form is not submitting some value to the Server-Side.
  • If none of the above helped resolve the problem: Try getting the form values by using Request["FormValueName"] Instead of passing the whole Modal and binding from the Modal.





For peering opportunity Autonomouse System Number: AS401345 Custom Software Development at ErnesTech Email AddressContact: [email protected]