1

我正在 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>

}

4

1 回答 1

2

您可以使用视图模型将房间 ID 从第一页传递到表单页面吗?

于 2012-04-25T16:53:45.510 回答