This is a migrated thread and some comments may be shown as answers.

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

3 Answers 141 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Sameer
Top achievements
Rank 1
Sameer asked on 19 Mar 2013, 01:21 AM
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

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 20 Mar 2013, 02:03 PM
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!
0
Nathan
Top achievements
Rank 2
answered on 28 May 2013, 03:21 AM
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.
0
Daniel
Telerik team
answered on 30 May 2013, 07:15 AM
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!
Tags
MVVM
Asked by
Sameer
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Nathan
Top achievements
Rank 2
Share this question
or