【问题标题】:Setting the height of a devexpress mvc Gridview combo box设置 devexpress mvc Gridview 组合框的高度
【发布时间】:2013-01-22 20:10:16
【问题描述】:

我正在使用带有几个组合框的 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()

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

【问题讨论】:

  • 谁能帮我解决这个问题?

标签: asp.net-mvc combobox devexpress


【解决方案1】:

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

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

【讨论】:

  • 感谢您的评论,但它似乎不起作用。上面提到的部门下拉列表中只有 2 行数据,我已经添加了你提到的代码行,它仍然只显示 2 行
猜你喜欢
  • 1970-01-01
  • 2011-02-02
  • 2012-06-22
  • 2023-03-24
  • 1970-01-01
  • 2011-03-10
  • 1970-01-01
  • 2021-11-22
  • 2016-01-18
相关资源
最近更新 更多