I want to implement w2ui grid and get data from server with parameter.I try to this way but ID posted null so what i am missing here?
function databindSquadMembers(ID) {
$('#myGrid2').w2grid({
name: 'myGrid2',
url: 'member/Find',
method: 'GET',
show: {
toolbar: true,
},
columns: [
{ field: 'PersonalCode', caption: 'PCode'},
{ field: 'FullName', caption: 'fName'},
],
postData: {
ID: ID,
},
});
}
Even if i try to this again ID is showing on controller null
postData: {
ID: 'ID', //or ID:'123'
},
And here is the server side;
public JsonResult Find(string ID) {
Squad squad = SquadFinder.FindByID(ID);
IEnumerable members = squad.Members.Cast<SquadMember>()
.Select(p => new
{
id = ID,
PersonalCode = p.Employee.Code,
FullName = p.FullName,
Email = (null != p.Employee ? p.Employee.Email : "")
});
return Json(members, JsonRequestBehavior.AllowGet);
}