设置devexpress mvc Gridview组合框的高度

时间:2013-01-22 20:10:17

标签: asp.net-mvc combobox devexpress

我正在使用带有几个组合框的DEvExpress mvc网格,我想知道如何设置下拉部分的最大/最小高度(在多行中)。

例如,我可以在滚动之前设置行可见,或者即使只有一行数据可以将下拉高度设置为特定行数。

我现在拥有的组合的当前代码是

@Html.DevExpress().ComboBox(edtSettings =>
{
    edtSettings.ControlStyle.CssClass = "employeeDetailsGridEditField";
    edtSettings.Name = "DepartmentID";
    edtSettings.Width = 350;
    //edtSettings.Height = 200; 
    //THIS sets the height of the initial control not the drop down part
    edtSettings.Properties.TextField = "DepartmentName";
    edtSettings.Properties.ValueField = "DepartmentID";
    edtSettings.Properties.ValueType = typeof(int);
    edtSettings.Properties.DropDownStyle = DropDownStyle.DropDown;
    edtSettings.ShowModelErrors = true;
}).BindList(Model.DepartmentList).Bind(Model.EmployeeSingle.DefaultDepartmentID).GetHtml()

下拉部分高度是否有属性?

1 个答案:

答案 0 :(得分:1)

使用ComboBoxProperties.DropDownRows属性同时获取或设置编辑器可滚动下拉窗口中显示的列表项数:

@Html.DevExpress().ComboBox(edtSettings =>
{
    //...
    edtSettings.Properties.DropDownRows = 5; // default is 7 
    //...        
}).BindList(Model.DepartmentList).Bind(Model.EmployeeSingle.DefaultDepartmentID).GetHtml()