代码之家  ›  专栏  ›  技术社区  ›  mathieu

ASP。NET MVC:模型中的属性值为空?

  •  0
  • mathieu  · 技术社区  · 17 年前

    <%= Html.TextBox("Something", Model.Property.SubProperty.Value) %>
    

    <% if( Model.Property != null || Model.Property.SubProperty != null ) { %>
    <%= Html.TextBox("Something", Model.Property.SubProperty.Value) %>
    <% } %> 
    

    但我觉得这不太干净。有人有主意吗?

    我在考虑自动售货机。好主意?

    1 回复  |  直到 17 年前
        1
  •  1
  •   AnthonyWJones    17 年前