I intend to pass the Hotel model into my action with the controller - do some checks / processing on it, and then return a potentially different Hotel model presented in a partial view,
The problem I get is that if I pass Model oHotelParameter to Action, then PartialView uses the model passed to Action instead of the one passed to the PartialView method.
If I remove the oHotelParameter parameter from the action, then the view is displayed as expected using oHotel .
public ActionResult _SaveMasterDetails(Hotel oHotelParameter) { //Do some processing on oHotelParameter //........ Hotel oHotel = new Hotel(); oHotel.GetHotelInfoById(14); //This gets a different Hotel object just for a test //For some reason oHotel is ignored and oHotelParameter is used instead unless I remove oHotelParameter return PartialView("_MasterDetails", oHotel); }
When I debug the view, I see that the model is set to the value that I pass to PartialView ( oHotel ), but the result that I see in the return from Action contains data from oHotelParameter .
If that matters, I call the action from jQuery ajax.
Can someone explain why this should happen?
source share