zoukankan      html  css  js  c++  java
  • MVC 校验

    @model MVCFirst.Models.Person
    @{
        Layout = null;
    }


    <!DOCTYPE html>


    <html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title>Add</title>
        <script src="~/Scripts/jquery-1.10.2.min.js"></script>
        <script src="~/Scripts/jquery.validate.min.js"></script>
        <script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
    </head>
    <body>
        <div> 
            @using (Html.BeginForm("Add", "Person", FormMethod.Post))
            {
                @Html.TextBoxFor(p => p.Id)
                @Html.ValidationMessageFor(p=>p.Id)
                @Html.TextBoxFor(p=>p.Name)
                <input type="submit" name="name" value="Add" />
            }
        </div>
    </body>

    </html>


    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Web;


    namespace MVCFirst.Models
    {
        public class Person
        {
            [Required(ErrorMessage ="编号不能为空")]
            [Range(10,100,ErrorMessage ="必须在10到100之间")]

            public int Id { get; set; }
            public string Name { get; set; }
        }




    }

  • 相关阅读:
    使用NetworkX进行社交分析
    文本情感分析
    使用NLTK进行基础的NLP处理
    使用pandas对文本数据进行处理
    文本处理
    分类器可视化
    无监督学习
    监督学习2
    模型验证
    Netty学习摘记 —— 预置SSL / HTTP / WebSocket编解码器
  • 原文地址:https://www.cnblogs.com/dxmfans/p/9434747.html
Copyright © 2011-2022 走看看