• netcore 开发问题整理(页面显示中文)


        public class TradeModel
        {
            [Display(Name = "编号")]
            public int Id { get; set; }
    
            [Display(Name = "物品名称")]
            [StringLength(200, MinimumLength = 1)]
            [Required(ErrorMessage = "此项不能为空")]
            public string Tradename { get; set; }
    
            [Display(Name = "物品数量")]
            public Nullable<double> Quantity { get; set; }
    
            [Display(Name = "物品单位")]
            public string Quantityunits { get; set; }
         [Display(Name
    = "价格")]      [DisplayFormat(DataFormatString = "{0:F}")]      public Nullable<double> Prices { get; set; } #region 扩展属性 不映射表字段 /// <summary> /// 物品单位枚举描述值获取 /// </summary> [NotMapped] public string QuantityunitsDescription { get { return Utils.EnumHelper.GetDescription<EnumModel.EnumQuantityunits>(Quantityunits); } set { Quantityunits = value; } }#endregion }
       @foreach (var item in Model.Trades)
       {
      //显示对应枚举值
      @Html.DisplayFor(modelItem => item.QuantityunitsDescription)
      }
    
         <label asp-for="Tradename" class="control-label"></label>
         <input asp-for="Tradename" class="form-control" />
         <span asp-validation-for="Tradename" class="text-danger"></span>

     

  • 相关阅读:
    redis
    java基础知识起步
    SQL(DML)语法
    jsp中的九大内置对象和四大作用域
    JDBC与javaBean
    javaScript知识点大全
    mysql数据库操作语法大全
    css前端知识点总结
    HTML前端小结
    代码整洁之道
  • 原文地址:https://www.cnblogs.com/Harvard-L/p/15470835.html
Copyright © 2020-2023  润新知