0
荫正从后端数据的表,现在我想这些数据如何将数据绑定到使用knockoutjs在C#中的WebForms
IAM正从后端数据绑定到表中的WebForms这样
[WebMethod]
[ScriptMethod]
private string GetAll()
{
SqlConnection con = new SqlConnection(@"Data Source=DEVENV1;Initial Catalog=KnockoutData;Integrated Security=True");
SqlCommand cmd = new SqlCommand("select * from sampledb", con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
}
现在通过使用Web表单的jQuery阿贾克斯IAM获取数据,这样的事情...
<script type="text/javascript">
$(document).ready(function() {
$('#btnEdit').click(function() {
var viewModel;
$.ajax({
type: "GET",
url: "KnockoutJs.aspx/GetAll",
contentType: "application/json",
success: function (data) {
var result = JSON.parse(data);
}
});
});
<script>
现在怎么这个数据绑定到下表,用knockoutJs的foreach
<table border="1">
<tr>
<th>Student Name</th>
<th>Roll No </th>
</tr>
</table>
看看这个淘汰赛[文档](http://knockoutjs.com/documentation/foreach-binding.html) – Martyn0627 2013-02-11 09:50:35