简体   繁体   中英

Dropdownlist mvc kendo ui option label

I have a form with multiple kendo dropdownlists..

@(Html.Kendo().DropDownListFor(m => m.TypeId)
    .DataTextField("Description")
    .DataValueField("Id").OptionLabel(" ")
    .DataSource(source =>
    {
        source.Read(read =>
        {
            read.Action("ReadType", "DropDownData");
        });
    })
)

Having the option label it shows the blank selection, but when you open the dropdownlist it doenst appear any option to select the "blank space". After choose some value of the dropdown i cant turn back.

I know that if i put some text in the dropdown the option label appear in the dropdown (with a css diferent from the rest). But i would like to mantain the blank space.

Other solution is to add a record in server side in the first position, but i would like to know if anyone has a diferent solution. Thanks

The OptionLabel is there as the first option of the select. The problem is that the height of the field is 0. I solved my problem styling the min-height of the element k-item to 20px.

.k-item {
    min-height: 20px;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM