グリッド ビューのフッターに「もっと見る」ボタンがあるとします。それをクリックすると、「Face Book」などの DB からさらにレコードを追加する必要があります。グリッドに完全に投稿することなく、それを行う必要があります。J Query、Jason、またはその他のものを使用してそれを行う方法はありますか
1 に答える
0
GridView
@Aristosが言ったように、サーバー側でバインドされているため、a を使用して行を追加することはできません。ただし、データのページを返す Web サービスを作成することはできます。これらは、リピーター<ul>
で作成したに追加できます。
[WebMethod]
[ScriptMethod(ResponseFormat=ResponseFormat.Json)]
public string Format(int offset, int limit) {
// return data from your database here
次にjQueryから、
var currentPage = 0;
var numPerPage = 30;
$.ajax({
url: '/YourService.asmx/GetData',
data: JSON.stringify({ 'offset': (numPerPage * ++currentPage), 'limit': numPerPage}),
type: 'POST',
dataType: 'json',
contentType: 'application/json; charset=utf-8',
success: function(response){
// response.d contains your formatted results. If you have a <ul>, you could append them simply by doing:
$.each(response.d, function() {
$('<li/>').html(this).appendTo('#yourList');
});
});
});
于 2013-01-24T12:52:12.370 に答える