Server side
SPWeb site = SPContext.Current.Web;
SPList list = site.Lists["GridList"];
SPListItemCollection items = list.Items;
DataTable dt = items.GetDataTable();
Gridnames.DataSource = dt;
Gridnames.DataBind();
client side
function getToolInfo() {
// var CamlQuery = "<Query><Where><Eq><FieldRef Name='Title'/><Value Type='Counter'>" + lastID + "</Value></Eq></Where></Query>";
var CamlViewFields = "<ViewFields><FieldRef Name='Title' /><FieldRef Name='Description' /></ViewFields>";
// this let me know that the function is getting called and passed the correct parameter value
alert('function called and passed last ID of : ' );
$().SPServices({
operation: "GetListItems",
async: false,
listName: "GridList",
CAMLViewFields: CamlViewFields,
// CAMLQuery: CamlQuery,
completefunc: function (xData, Status) {
$(xData.responseXML).find("[nodeName='z:row']").each(function () {
alert($(this).attr("ows_Title"));
alert($(this).attr("ows_Description"));
});
}
});
}