MVC model does not update when data populated through jQuery

2 posts, 0 answers
  1. Ram
    Ram avatar
    3 posts
    Member since:
    Apr 2015

    Posted 03 Jun 2016 Link to this post

    I'm using a kendo grid popup editor. I have a custom template (partial view) for edit. I have a drop down and on change event, I'm populating a TextBox. The problem is when I am sending the model to the controller, the TextBox value is null. It's not updating the model with the populated value. Any idea why?

    @(Html.Kendo().DropDownListFor(w => w.AddressID)



    .DataSource(source =>{ source.Read(read =>{ read.Action("GetAddressType", "DataSource")




    .Events(e => e.Change("addressSubType"))



    @Html.TextBoxFor(model => model.AddressLine1)

    On an AJAX done function, I'm populating the value.

    I can see the new value in the text box but when submitted, it sends null to the controller. If I enter the value in the AddressLine1 field instead of populating, it sends the entered value to the controller.

  2. Eyup
    Eyup avatar
    3962 posts

    Posted 07 Jun 2016 Link to this post

    Hello Ram,

    To help the grid to "capture" the new value you've set manually using script, you can try using the following approach:

    I hope this will prove helpful.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top