我正在MVC 3的酒店预订项目上工作 我在这里展示房间:
当我点击预订romm时,我到了这里:
但我想做的是直接在预订表格房间框中获取我选择的房间号码。
以下是我的预订创建视图:
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>Reservation</legend>
<div class="editor-label">
@Html.LabelFor(model => model.Room_ID, "Room")
</div>
<div class="editor-field">
@Html.DropDownList("Room_ID", String.Empty)
@Html.ValidationMessageFor(model => model.Room_ID)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Guest_ID, "Client")
</div>
<div class="editor-field">
@Html.DropDownList("Guest_ID", String.Empty)
@Html.ValidationMessageFor(model => model.Guest_ID)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Data_Check_in)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Data_Check_in)
@Html.ValidationMessageFor(model => model.Data_Check_in)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Data_Check_out)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Data_Check_out)
@Html.ValidationMessageFor(model => model.Data_Check_out)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Preference_ID, "Preferinte")
</div>
<div class="editor-field">
@Html.DropDownList("Preference_ID", String.Empty)
@Html.ValidationMessageFor(model => model.Preference_ID)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Price)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Price)
@Html.ValidationMessageFor(model => model.Price)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Card_ID, "Card_de_credit")
</div>
<div class="editor-field">
@Html.DropDownList("Card_ID", String.Empty)
@Html.ValidationMessageFor(model => model.Card_ID)
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
}
答案 0 :(得分:2)
您可以使用视图模型将房间ID从第一页传递到表单页面吗?