ここにグリッドビューがあり、取得したデータを jquery を使用して追加します。グリッドビューでページングを使用したい。しかし、それは機能していません。理由はわかりません.. jqueryなしでグリッドを通常どおりバインドする他のアプリケーションで同じメソッドを使用すると、完全に正常に機能するためです。私のコードを見直して、何が間違っているのか教えてください
これは私のグリッドです。
<form runat="server">
<asp:GridView ID="GridView1" ClientIDMode="Static" runat="server" AutoGenerateColumns="False" AllowPaging="True" PageSize="5" GridLines="None" CellSpacing="10" >
</asp:GridView>
これはグリッドに value(bind) を追加する私の jquery コードです。
$("#search-user")
.button()
.click(function () {
$.ajax({
contentType: "application/json; charset=utf-8",
url: "MyHandler.ashx",
data: {
'user': "" + $("#txtsearch").val(),
'method': 'search'
},
dataType: "json",
success: updateGrid,
error: function (result) { alert("Error- Inside user Searching "); }
});
});
function updateGrid(data) {
var i = 0;
var content;
$("#GridView1").html(''); // clearing the old data in grid
$("#GridView1").append("<tr><th>" + "Name" + "</th><th>" + "Gender" + "</th><th>" + "Date of Birth" + "</th><th>" + "Role" + "</th><th>" + "Password" + "</th><th>" + "Email" + "</th></tr>");
while (data[i] != null)
{ // appending the retrieved data to grid
$("#GridView1").append("<tr><td>" + data[i].name + "</td><td>" + data[i].gender + "</td><td>" + data[i].dob + "</td><td>" + data[i].role + "</td><td>" + data[i].password + "</td><td>" + data[i].email + "</td></tr>");
i++;
}
}