blank row

2 posts, 0 answers
  1. Louis
    Louis avatar
    42 posts
    Member since:
    Jun 2011

    Posted 03 Feb 2014 Link to this post

    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                                                 
    )

  2. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 04 Feb 2014 Link to this post

    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!
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top