• asp.mvc 基本知识


    (1)@Html.DisplayNameFor(model => model.Title)是显示列名,
    
    (2)@Html.DisplayFor(modelItem => item.Title)是显示列的内容
    
    (3)@Html.ActionLink("Create New", "Create")是超链接,跳转到model中的create页面,引用的是controller中create方法;
    
    (4)@Html.ActionLink("Edit", "Edit", new { id=item.ID })编辑页面;
    
    (5)@using (Html.BeginForm()) {   @Html.ValidationSummary(true)}用于客户端验证,其Html.BeginForm()表示在本页显示
    
    (6)<div class="editor-label">
                @Html.LabelFor(model => model.Time)标签
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Time)编辑框
                @Html.ValidationMessageFor(model => model.Time)验证合法性错误显示
            </div>
    
    @model IEnumerable<MvcMovie.Models.Movie>
    @{
        ViewBag.Title = "Index";
    }
    <h2>Index</h2>
    <p>
        @Html.ActionLink("Create New", "Create")
        @using (Html.BeginForm("Index", "Movies", FormMethod.Get))
        {
        <p>
            Genre: @Html.DropDownList("movieGenre", "All")
            Title: @Html.TextBox("SearchString")
            <input type="submit" value="Filter" />
        </p>
        }
    </p>
    <table class="table">
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.Title)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.ReleaseDate)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Genre)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Price)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Rating)
            </th>
    
            <th></th>
        </tr>
    
    @foreach (var item in Model) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Title)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ReleaseDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Genre)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Price)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Rating)
            </td>
    
            <td>
                @Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
                @Html.ActionLink("Details", "Details", new { id=item.ID }) |
                @Html.ActionLink("Delete", "Delete", new { id=item.ID })
            </td>
        </tr>
    }
    
    </table>
    
    
    
  • 相关阅读:
    linux脚本练习之将数据导入oracle表
    linux脚本之一个程序调用另一个程序
    使用客户端Navicat连接数据库oracle19c
    centos7安装与卸载oracle19c
    Redis-cluster集群搭建(redis版本5.0.4)
    linux下redis的哨兵模式
    使用POI导入Excel文件
    MySQL8.0搭建MGR集群(MySQL-shell、MySQL-router)
    MySQL Shell用法
    CentOS 7下使用rpm包安装MySQL8.0
  • 原文地址:https://www.cnblogs.com/chenmfly/p/5814103.html
Copyright © 2020-2023  润新知