asp.net-mvc-3 - @Html.DropDownList 宽度

标签 asp.net-mvc-3 razor

问:如何设置 @Html.DropDownList 的宽度(而不是在 css 中)?

@Html.DropDownList("ListId", String.Empty, new {style="width: 250px;"})  @* no go!*@

最佳答案

您应该使用 View 模型方法。然而,懒惰的出路就是给第二个参数一个空值。

@Html.DropDownList("ListId", null, new {style="width: 250px;"})

关于asp.net-mvc-3 - @Html.DropDownList 宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7615321/

相关文章:

asp.net-mvc-3 - ASP MVC 3 在构建服务器上缺少 WebApplication.targets

c# - ASP.NET MVC - FormsAuthentication.SetAuthCookie() 和 Roles IsUserInRole - 奇怪的行为

c# - mvc4复选框更新数据库

c# - MVC3 AJAX 中的分页数据

razor - 在使用WebMatrix + Razor制作的网站上生成站点地图

c# - .NET 中的异常处理和日志记录策略

c# - session 返回空

c# - 除了一个(登录)之外,保护 Controller 所有操作的最佳方法是什么?

asp.net-mvc - Razor _Layout.cshtml 中的嵌入代码

jquery - Trirand jqGrid 未显示; TypeError : $(. ..).jqGrid 不是函数