This is a migrated thread and some comments may be shown as answers.

blank row

1 Answer 216 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Louis
Top achievements
Rank 1
Iron
Iron
Iron
Louis asked on 03 Feb 2014, 08:07 PM
Hi,

How I can insert a blank row in a DropDownList

controller :

ViewBag.NoSource = new SelectList(db.Sources, "NoSource", "CodeSource");


View :

@(Html.Kendo().DropDownList()
    .Name("NoRisque") // Name of the widget should be the same as the name of the property
    .DataValueField("Value") // The value of the dropdown is taken from the EmployeeID property
    .DataTextField("Text") // The text of the items is taken from the EmployeeName property                                                       
    .BindTo((SelectList)ViewBag.NoSource) // A list of all employees which is populated in the controller                                                 
)

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 04 Feb 2014, 11:22 AM
Hello Louis,

You need a data item with empty text, there is no other way.

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
DropDownList
Asked by
Louis
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Dimo
Telerik team
Share this question
or