Hi
I have create a page that display a list of data.
.chstml file is
<h2>Customer Profile Configuration </h2>
<hr />
<table class="table table-striped table-bordered table-condensed">
<tr>
<th>Data Field Name</th>
<th>Display Text</th>
<th>Is Mandatory</th>
<th>IsActive</th>
<th></th>
</tr>
<tbody data-bind="foreach: CustomerProfileConfigurations">
<tr>
<td class="name"><a data-bind="text: DataFieldName, click: $parent.editCustomerProfileConfiguration"></a></td>
<td>
<input class="input-large" data-bind='value: DisplayText' placeholder="DisplayText" />
</td>
<td>
<input class="input-large" data-bind='value: IsMandatory' placeholder="IsMandatory" />
</td>
<td>
<input class="input-large" data-bind='value: IsActive' placeholder="IsActive"/>
</td>
</tr>
</tbody>
</table>
<input type="button" class="btn btn-small btn-primary" value="Save Customer Profile Configuration" data-bind="click:$root.UpdateCustomerProfileConfiguration" />
<script src="~/Scripts/CustomerProfileConfigurationTest.js"></script>
and Javascript Code is
var CustomerProfileConfigurationViewModel = function () {
debugger;
var self = this;
var url = "/CustomerProfileConfiguration/GetAllCustomerProfileConfigurations";
var refresh = function () {
$.getJSON(url, {}, function (data) {
self.CustomerProfileConfigurations(data);
});
};
// Public data properties
self.CustomerProfileConfigurations = ko.observableArray([]);
// Public operations
self.UpdateCustomerProfileConfiguration= function () {
// How can I bind the page data and send for update .............
};
refresh();
};
ko.applyBindings(new CustomerProfileConfigurationViewModel());
Page is working perfectly to view data.
The problem is, How can I update list of data ?
How can i Bind list of data in java script file through saveCustomerProfileConfiguration javascript method by click on Update button and send it to manager layer for save it?