5
EditorTemplate
にいくつかの追加プロパティを渡すにはどうすればよいですか?EditorTemplateに追加プロパティを渡す
私はこの(擬似コードの一種)のようにそれを使用したい:
@Html.EditorFor(m => m.ReturnFlight, new { additionalViewData = new { FlightType = FlightType.Return } })
@Html.EditorFor(m => m.OutboundFlight, new { additionalViewData = new { FlightType = FlightType.Outbound } })
FlightTemplate:
<h1>FLight @Model.FlightNumber</h1>
@if(FlightType == FlightType.Outbound)
{
// Display stuff for outbound flights
}
else if(FlightType == FlightType.Return)
{
// Display stuff for return flights
}
@Form.TextboxFor(m => m.Destination)
あなたの迅速かつ偉大な答えてくれてありがとうは、ViewBag部分を逃したし、それが今取り組んでいます。 –