i want data for databind in gridview using jquery in row wise only, no need of columnswise
means only one column there, but want to data according to row
<script type="text/javascript">
$(function () {
$.ajax({
type: "POST",
url: "Default.aspx/GetChatDatas",
data: {},
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
error: function (r) { alert(r.responseText); }
});
return false;
});
function OnSuccess(response) {
var chatDatas = response.d;
var row = $("[id*=grdchat] tr:last-child").clone(true);
$("[id*=grdchat] tr").not($("[id*=grdchat] tr:first-child")).remove();
for (var i = 0; i < chatDatas.length; i++) {
for (var j = 0; j < chatDatas[i].length; j++) {
$("td", row).eq(j).html(chatDatas[i][j]);
}
row.removeClass();
row.addClass(chatDatas[i][chatDatas[i].length - 1]);
$("[id*=grdchat]").append(row);
row = $("[id*=grdchat] tr:last-child").clone(true);
}
}
</script>
in this code we are adding value to all column, if i wnat to add only row and with insertion of html in row can add any column there.
for (var i = 0; i < chatDatas.length; i++) {
for (var j = 0; j < chatDatas[i].length; j++) {
$("td", row).eq(j).html(chatDatas[i][j]);
}
}
here how to add value in row???