ホテルモデルをコントローラー アクションに渡すつもりです。いくつかのチェック/処理を行ってから、部分ビューでレンダリングされた別のホテルモデルを返す可能性があります。
私が得ている問題は、oHotelParameterモデルをアクションに渡すと、PartialView メソッドに渡されたモデルではなく、アクションに渡されたモデルを使用することです。
アクションからoHotelParameterパラメータを削除すると、ビューは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);
}
ビューをデバッグすると、モデルが PartialView ( oHotel ) に渡した値に設定されていることがわかりますが、アクションから返された結果にはoHotelParameterオブジェクトからのデータが含まれています。
違いが生じる場合に備えて、jQuery ajax からアクションを呼び出しています。
なぜこれが起こるべきなのか誰でも説明できますか?