• .net mvc Razor 三元运算判断赋值 ?:


    预期效果:

    当Model中的Age数字列值为0时,不显示该值。

    <input type="text" class="form-control onlyPositiveNumber" id="Age" 
    maxlength="3" style="text-align:right;80px; " value='@(Model.Age == 0? "":Model.Age.ToString())' >

     预期效果:

    根据ViewData中的值,判断radio是否需要被选中

    <input type="radio" id="rdoReportTypeBS" name="ReportType" disabled="disabled" value="BS"
      @(ViewData["ReportType"].ToString().ToUpper() == "BS"?"checked":"") >

  • 相关阅读:
    作业6
    作业8
    作业7
    作业5
    作业4
    作业3
    作业2
    作业1
    浏览器跨域的细节
    解析node-cors模块
  • 原文地址:https://www.cnblogs.com/freeliver54/p/8118684.html
Copyright © 2020-2023  润新知