No data being posted

3 posts, 0 answers
  1. Allan
    Allan avatar
    34 posts
    Member since:
    Aug 2015

    Posted 18 Nov 2015 Link to this post

    Hi there,

    My form has a combo box that is populated from a viewbag in a controller.  The Combobox isn't posting any data when the form is submitted however.  I don't get any errors but the values in the database are always null.  What have I done wrong?

     The Combobox Code


          .Placeholder("-- Select Duties --")

     My Viewbag in my Controller Code

    IEnumerable<SelectListItem> duties = mydata.tbl_workscopes
        .Select(c => new SelectListItem
            Value = c.idx_index.ToString(),
            Text = c.code
    ViewBag.duties = duties;

  2. Alexander Popov
    Alexander Popov avatar
    1436 posts

    Posted 20 Nov 2015 Link to this post

    Hello Allan,

    The ComboBox widget has an input element with a name attribute equal to the Name specified in the widget's configuration. Basically, posting the form should include that input element, however it might not be bound on the server in case the Model has no field with matching name. You can check the browser's network tab and verify what is being posted. If that is indeed the case, then I would suggest either set a matching name or use the ComboBoxFor helper instead (without explicitly specifying the name). For example: 
    @(Html.Kendo().ComboBoxFor(m=>m.SomeModelField) ... )

    Alexander Popov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. CIQIntegration
    CIQIntegration avatar
    4 posts
    Member since:
    Jul 2015

    Posted 02 Dec 2015 Link to this post

    Hi Allan,

    i dont know if you still got this issue.

    keep in mind you'll need to add the deferred option on the combobox - like so:

    @(Html.Kendo().ComboBoxFor(m => m.Contract.ContractName)
                                               .HtmlAttributes(new { @class = "form-control", style = "width:100%" })
                                               .DataSource(s =>
                                                   s.Read(r =>
                                                       r.Action(MVC.Contract.ActionNames.LookupList, MVC.Contract.Name);


    hopte this helps


Back to Top