MVVM to bind textboxes to a row of data returned from remote datasource

4 posts, 0 answers
  1. Sameer
    Sameer avatar
    3 posts
    Member since:
    Jun 2010

    Posted 18 Mar 2013 Link to this post

    We are retrieving details for the selected row in a grid from a remote data source. The data retrieval works as expected. We have an Observable object from the data returned from this call. We would like this information to be bound to few textboxes and checkboxes on page using the Kendo.Bind() method, but for some reason it does not work. It does work if we bind it to a drop down list but not to a textbox or label for that matter.

    I understand we are getting a table from the remote data (in JSON), but what we would like is to bind certain row and column to a textbox.

    This is the example of data returned from remote service -
    var data = [{ "FundingResourcePolicyDetailId": 1146060, "PatientFundingResourceId": 3594866, "IdNumber": "91234567y1", "IssueDate": "04/30/2012", "StartDate": "04/15/2012", "EndDate": "04/30/2012", "Group": "", "CoPay": 0.0, "Deductible": 0.0, "PercentageCoverage": 0, "Basic": 0, "Preventive": 0, "Major": 0, "IsVerified": false, "IsAssingmentAccepted": true, "CardFirstName": "MICKEY", "CardLastName": "TESTPATIENT", "CardMiddleInitials": "TICKLE PIN" }];

    Here is a example of what we are trying to accomplish-

    http://jsfiddle.net/qvKRk/402/

    Thanks.
    Sameer
  2. Daniel
    Admin
    Daniel avatar
    2118 posts

    Posted 20 Mar 2013 Link to this post

    Hello Sameer,

    At least in the jsFiddle example the textbox is not populated because the path is not correct. The specified path for the binding should be "selectedProduct.ProductName". I have updated the jsFiddle sample with the correct path. Binding selected Grid row should be the same. 

    Regards,
    Daniel
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Nathan
    Nathan avatar
    39 posts
    Member since:
    Sep 2011

    Posted 27 May 2013 Link to this post

    Dumb question - how do you select an item by default?

    The drop-down list thing is kind of useful unless there is only 1 item in which case it doesn't work!

    Also, how can I do it without having the drop-downlist.  In fact, can I just limit it to 1 record?

    I've spent huge amounts of time looking online but cant find ANY example ANYWHERE of how to do it.
  5. Daniel
    Admin
    Daniel avatar
    2118 posts

    Posted 30 May 2013 Link to this post

    Hello Nathan,

    An item can be selected initially by setting the initial value in the model. I am not sure if I understand what you mean by not using a dropdownlist, but you could just set the object(selectedProduct in the jsFiddle) and the inputs will still be populated. 

    Regards,
    Daniel
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top
Kendo UI is VS 2017 Ready