我有我的asp.net mvc的視圖中下面的代碼: -如何創建一個空的Html.DropDownlistFor及如何禁用Html.TextBox
@Html.DropDownListFor(model => model.FirewallCustomer.CustomerVLANSID,null, null, null)
@Html.ValidationMessageFor(model => model.FirewallCustomer.CustomerName)
<div><span class="f">VLAN IP</span> @Html.TextBox("VLANIP", new { disabled = "disabled"})</div>
,但上面的代碼將提高對DropDownListFor錯誤: -
沒有類型爲「IEnumerable」的ViewData項目 具有密鑰「FirewallCustomer.CustomerVLANSID」。
對於TexBox,它將在文本框體內顯示disabled = "disabled"
,而不是禁用它。任何人都可以adivce如何解決我的下拉列表&我的文本框問題? Thanks`
在DropDownListFor試圖傳遞一個空值列表,但文本框不爲空 – LINQ2Vodka
:讀其conctructor簽名,你把HTML attribtes錯了地方 – LINQ2Vodka