zoukankan      html  css  js  c++  java
  • MVC3.0 提交表单的方法

    在views中使用 @using (Html.BeginForm()) 来完成,其中放一个submit类型的提交按钮,如:

    @using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
    <legend>人员信息</legend>

    @Html.HiddenFor(model => model.ID)

    <div class="editor-label">
    @Html.LabelFor(model => model.Code,"编号")
    </div>
    <div class="editor-field">
    @Html.EditorFor(model => model.Code)
    @Html.ValidationMessageFor(model => model.Code)
    </div>

    <div class="editor-label">
    @Html.LabelFor(model => model.Name,"姓名")
    </div>
    <div class="editor-field">
    @Html.EditorFor(model => model.Name)
    @Html.ValidationMessageFor(model => model.Name)
    </div>
    <div class="editor-label">
    @Html.LabelFor(model => model.RoleName,"角色")
    </div>
    <div class="editor-field">
    @Html.DropDownList("RoleName")
    @Html.ValidationMessageFor(model => model.RoleName)
    </div>

    @Html.HiddenFor(model => model.Password)

    <div class="editor-label">
    @Html.LabelFor(model => model.Remark,"备注")
    </div>
    <div class="editor-field">
    @Html.EditorFor(model => model.Remark)
    @Html.ValidationMessageFor(model => model.Remark)
    </div>

    <p>
    <input type="submit" value="保存" />
    </p>
    </fieldset>
    }
  • 相关阅读:
    关于网页代码加密解密保护,保障页面安全
    DS--知识积累
    知识积累
    Nested DollsHDU1677
    CF335B
    HDU2385Stock
    滚动数组处理数据很大的公共子序列问题
    HDU4635
    HDU4638
    HDU4639
  • 原文地址:https://www.cnblogs.com/muxueyuan/p/3929572.html
Copyright © 2011-2022 走看看