Forum
00:07
03/01/2014
I'd like to get the html '<select>...</select>' from the GetGradeDescList method of the StartingPoint controller (blue highlight below) to populate the dropdown listbox when editing the row, but cannot figure out the correct invocation to pass the parameters. What am I missing?
Code:
function loadGrid() {
var blend = $("#Blends").val();
var urlstring = '<%= Url.Action("GetStartingPoint", "StartingPoint")%>' + '?blend=' + blend;
var gradeTypeCd;
var gradeCd;
var units;
$('#fu').jqGrid({
url: urlstring,
datatype: 'json',
mtype: 'GET',
colNames: ['Id', 'Grade Type Cd', 'Grade Cd', 'Units', 'GradeDesc'],
colModel: [
{ name: 'Id', key: true, index: 'Id', width: 20, align: 'left', editable: false, hidden: true },
{ name: 'GradeTypeCd', key: true, index: 'gradeTypeCd', width: 150, align: 'left', editable: false },
{ name: 'GradeCd', index: 'gradeCd', width: 100, align: 'left', editable: false },
{ name: 'Units', index: 'units', width: 50, align: 'left', editable: false },
{ name: 'GradeDesc', index: 'gradeDesc', width: 250, align: 'left', editable: true, edittype: 'select',
editoptions: { dataUrl: '<%=Url.Action("GetGradeDescList", "StartingPoint")%>' + '?blend=' + blend + '&gradeTypeCd=' + gradeTypeCd + '&gradeCd=' + gradeCd + '&unit=' + units },
}
],
pager: $("#pager"),
viewrecords: true,
height: 400,
width: 600,
toppager: true,
rowNum: 50,
rowList: [10, 20, 50],
imgpath: '~/Scripts/Themes/sand/images',
caption: 'View/Edit Starting Points',
gridview: true,
jsonReader: { repeatitems: true, id: "Id", cell: "cell", root: "rows", page: "page", total: "total", records: "records" },
onSelectRow: function (id) {
var grid = jQuery('#fu');
var row_id = grid.jqGrid('getGridParam', 'selrow');
gradeTypeCd = grid.jqGrid('getCell', row_id, 'GradeTypeCd');
gradeCd = grid.jqGrid('getCell', row_id, 'GradeCd');
units = grid.jqGrid('getCell', row_id, 'Units');
//alert("blend = " + blend + ", gradeTypeCd = " + gradeTypeCd + ", gradeCd = " + gradeCd + ", unit= " + units);
}
}).navGrid("#pager", { edit: true, add: false, del: false, refresh: true, search: false },
{
url: '<%= Url.Action("EditStartingPoint", "StartingPoint")%>',
onclickSubmit: function (params, postdata) {
postdata.BlendCd = $("#Blends").val()
},
closeAfterEdit: true,
reloadAfterSubmit: true,
onSubmit: function (response) {
alert(response.responseText);
}
}
);
}
Controller Code:
public string GetGradeDescList(string blend, string gradeTypeCd, string gradeCd, int unit)
{
string selectList = "<select>";
... string concatentation removed for brevity ...
selectList = selectList + "</select>";
return selectList;
}
Most Users Ever Online: 715
Currently Online:
60 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66