2017-08-01 157 views
0

MVC ComboBox控件的默认值太大&想要将高度设置得更小。我已经看了各种在线&试图他们无济于事。我想设置高度为30px。他们使用EM,所以我有将其转换为1.90em设置KendoUI MVC组合框的高度

enter image description here

的事情,我已经尝试过...

  1. 我已尝试设置.k-input { height: 1.875em; } .k-select { height: 1.875em; }
  2. 我试图在MVC控制(本身)设置.Height(30)
  3. 我已尝试设置.HtmlAttributes(new { style = "height: 30px; width:100%;" }))

问:什么是设置高度的正确方法?

样品MVC控制:

@(Html.Kendo().ComboBox() 
    .Name("ddlDeviceType") 
    .Filter("contains") 
    .Placeholder("Select Device Type...") 
    .DataTextField("Text") 
    .DataValueField("Value") 
    .BindTo(new List<SelectListItem>() { 
     new SelectListItem() { Text = "Bristol-3330", Value = "1" }, 
     new SelectListItem() { Text = "Eagle", Value = "2" }, 
     new SelectListItem() { Text = "Flow Automation-Autopilot", Value = "3" }, 
     new SelectListItem() { Text = "ROC-300 FLASHPAC", Value = "4" } 
    }) 
    .Suggest(true) 
    .HtmlAttributes(new { style = "width:100%;" })) 

回答

2

还有,你需要使用,以减少一些嵌套元素的高度几个CSS选择器。

您的要求会是什么样子:

.k-dropdown-wrap { 
    border-radius: 0px; 
    font-size: 12px; 
} 
.k-combobox .k-input { 
    height: 2em; 
} 

.k-dropdown-wrap .k-select { 
    line-height: 2em; 
    min-height: 1em; 
} 
.k-combobox .k-dropdown-wrap:before { 
    height: 1em; 
    padding-bottom: 0; 
} 

.k-webkit .k-combobox .k-dropdown-wrap:before { 
    padding-bottom: 0; 
} 

ALSO ...
这是一个在线例如,你可以使用: http://dojo.telerik.com/OvaWE

+1

这是完美的。如果没关系,当我将它修复到我的“规格”时,我会根据这些规格更新您的答案并将其标记为正确 –

+1

注意:请务必将“行高”更改为某种东西 - 略高于1 –

+0

虽然我非常喜欢KendoUI,Telerik/Progress有时真让我失望!我一直在努力几个小时来设置一个简单的小部件的高度。难以置信的。这家伙值得一杯啤酒。 +1 – Alan