DropDownListFor crashing on submit

2 posts, 0 answers
  1. Ashvinder
    Ashvinder avatar
    3 posts
    Member since:
    Oct 2011

    Posted 16 Jun 2014 Link to this post

    I have defined a DropDownListFor in my view as follows:
    @(Html.Kendo().DropDownListFor(m=>m.BusinessUnitId)
     .OptionLabel("Select item...")
     .BindTo(new SelectList(Model.BusinessUnitList, "Key", "Value"))
    )
    where BusinessUnitList is a Dictionary<string, string> of value BusinessUnitIds and their descriptions.
    Everything looks good on the screen and I can select a value and see its value via jQuery using: $("#BusinessUnitId").val()
    However, when I try to submit the form, I get the following error:
    System.ArgumentNullException
    "Value cannot be null. Parameter name: items"
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 18 Jun 2014 Link to this post

    Hi Ashvinder,

    I am afraid that the provided code snippet does not reveal what exactly is causing the error. Sharing live link, or ideally - a runnable sample project where the issue is reproduced would help us pinpoint the exact reason for this behavior and advise you further. 

    Regards,
    Alexander Popov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top