如何为ListBoxFor添加样式?

时间:2012-08-25 15:04:53

标签: css asp.net-mvc

如何将以下样式添加到ListBox下面,

@Html.ListBoxFor(m => m.AvailableProducts, new MultiSelectList(Model.AvailableProducts, "Id", "Name", Model.AvailableSelected),
                         new Dictionary<string, object> { { "data-bind", "options:availableProducts, selectedOptions:availableSelected, optionsText:'Name'" } })

CSS

div.selectbox-wrapper ul {
list-style-type:none;
margin:0px;
padding:0px;
}
div.selectbox-wrapper ul li.selected { 
background-color: #EAF2FB;
}
div.selectbox-wrapper ul li.current { 
background-color: #CDD8E4;
}
div.selectbox-wrapper ul li {
list-style-type:none;
display:block;
margin:0;
padding:2px;
cursor:pointer;
}

1 个答案:

答案 0 :(得分:0)

使用jQuery插件将<select>元素更改为<div><ul>的{​​{1}}。

示例在这里:Is it possible to style a select box?