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

Bind data to control through Remote binding

0 Answers 129 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Govindu
Top achievements
Rank 1
Govindu asked on 27 Jun 2012, 10:50 AM
Hi,

I have a prolem while assigning data to control which is generated from another page. While routing to another page, I am not able to assign the selcted value to a text box.

Please help me in this regard. Code is below here:

@{ 
    ViewBag.Title = "TaskDetailListView";
    Layout = "~/Views/Shared/_Layout.cshtml";
} 
    <div id="formcontainer">
        <div id="demo">
     Order ID: <input data-bind="value: OrderID" /><br />
     Shipment Name: <label data-bind="text: ShipName" ></label>  
 </div>

   </div>

    <script type="text/javascript">

        $(document).ready(function () {

 

            var productsSource = new kendo.data.DataSource({

                transport: {

                    read: {

                        contentType: "application/json; charset=utf-8",

                        type: "GET",

                        dataType: "json",

                        url: "http://localhost:23794/api/Task/TaskItem"

                    }

                },

                schema: {

                    total: function (result) {

                        alert(JSON.stringify(result));

                    },

                    model: {

                        id: "OrderID",

                        fields: {

                            OrderID: { type: "number" },

                            ShipName: { type: "string" }

                        }

                    }

                }

            });

 

            var viewModel = kendo.observable({

                dataSource: productsSource

 

            });

             productsSource.fetch();

 

            kendo.bind($("#formcontainer"), viewModel);

          

        });                  

    </script>

 

No answers yet. Maybe you can help?

Tags
MVVM
Asked by
Govindu
Top achievements
Rank 1
Share this question
or