【问题标题】:Set value to @Html.Editor MVC将值设置为 @Html.Editor MVC
【发布时间】:2015-11-24 20:21:03
【问题描述】:

谁能帮帮我,我有以下几点:

@Html.Editor("entities[" + @k + "].Amount", entity.Amount)

我希望编辑器在文本字段中显示金额。我尝试了以下方法:

@Html.Editor("entities[" + @k + "].Amount", entity.Amount, new { @Value = "45"}) <text> m</text>

我收到以下错误:

CS1928: 'System.Web.Mvc.HtmlHelper<ProjectName.Order>' does not contain a definition for 'Editor' and the best extension method overload 'System.Web.Mvc.Html.EditorExtensions.Editor(System.Web.Mvc.HtmlHelper, string, string, object)' has some invalid arguments.

有什么建议吗? 谢谢!

【问题讨论】:

    标签: razor model-view-controller view


    【解决方案1】:

    我改用了 TextBox,效果很好 =)

    @Html.TextBox("entities[" + @k + "].Amount", entity.Amount, new { htmlAttributes = new { @class = "text-field" } })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-05
      • 2016-06-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多