【问题标题】:Asp.Net MVC 3 DropDownListFor, any way to always show the OptionLabel defaultAsp.Net MVC 3 DropDownListFor,始终显示OptionLabel默认值的任何方式
【发布时间】:2012-03-01 10:59:56
【问题描述】:

在 MVC 3 中,我有一个 Html.DropDownListFor 效果很好。它就像绑定到模型一样工作,所以当我更改为特定的东西时,模型也会发生变化。

问题在于,出于美观的原因,我不想让 OptionLabel 始终是显示的而不是实际值。所以会选择 DropDownList 来选择值,但不必显示值。

有什么办法吗?

【问题讨论】:

    标签: c# asp.net-mvc-3 razor drop-down-menu html-helper


    【解决方案1】:

    您可以创建一个自定义下拉列表来开发帮助器 Html 的扩展方法。

    【讨论】:

    • 当然,但我什至不知道 HTML 需要什么才能以这种方式进行设置。我去看看。
    猜你喜欢
    • 2014-06-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-30
    • 1970-01-01
    • 2021-05-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多