Not able to bind the records using knockout
By using the following article :
http://www.dotnetcurry.com/ShowArticle.aspx?ID=847, I tried to develop the
sample app. In order to keep things separate I tried to move the
javascript code to a separate js file : EmployeeInfo.js and referenced the
js file in the head section of the Create.cshtml as mentioned below:
<head>
<script src="~/Scripts/EmployeeInfo.js"></script>
</head>
But I am not able to display the existing records from the database. On
debugging the code I found that the GetEmployees() method is invoked and
data.length is also greater than 0 but the data is not able to bind with
the table to display all the records. Any help on this is appreciated.
<tbody data-bind="foreach: Employees">
<tr style="border: solid"
data-bind="click:
$root.getselectedemployee" id="updtr">
<td><span data-bind="text:
EmpNo"></span></td>
<td><span data-bind="text:
EmpName"></span></td>
<td><span data-bind="text:
Salary"></span></td>
<td><span data-bind="text:
DeptName"></span></td>
<td><span data-bind="text:
Designation"></span></td>
<td>
<button data-bind="click:
$root.deleterec">Delete</button></td>
</tr>
</tbody>
Can anyone help me to understand the problem.
Thanks & Regards, Santosh Kumar Patro
No comments:
Post a Comment