I have a grid which I am attempting to update using a webmethod in aspx. I get an error coming back about server not sending a proper response back. When I debug, the method is not being called. I think it has to do with the method signature. The grid loads up just fine and the paging works as well. I have simplified the grid but subbing in a json object for the data source.
var subs = [
{ IDX: 1, BarraModelId: "USE3L", BarraId: "KORACL3", AltBarraId: "USA9EX1" }
];
$("#SecuritySubs").igGrid({
columns: [
{ key: "IDX", dataType: "number", width: "10px" },
{ headerText: "Barra Model ID", key: "BarraModelId", dataType: "string", width: "150px"},
{ headerText: "Barra Id", key: "BarraId", dataType: "string", width: "150px" },
{ headerText: "Alternate Barra Id", key: "AltBarraId", dataType: "string", width: "150px" }
],
autoCommit: true,
defaultColumnWidth: 100,
alternateRowStyles: false,
primaryKey: "IDX",
requestType: "POST",
responseDataKey: "d.Items",
caption: "Barra Security Substitution",
// dataSourceUrl: "Main.aspx/GetSubstitutions",
dataSource: subs,
updateUrl: "Main.aspx/Update",
autoGenerateColumns: false,
features: [
{
name: "Filtering",
type: "local",
mode: "advanced",
filterDialogWidth: 600,
filterDialogHeight: 350,
filterDialogColumnDropDownDefaultWidth: 175,
filterDialogFilterDropDownDefaultWidth: 125,
filterDialogContainment: "window"
},
name: "Sorting",
columnSettings: [
columnIndex: 0,
allowSorting: false
}]
name: "Paging",
type: "remote",
pageSize: 50,
recordCountKey: "d.TotalRecordsCount",
pageSizeUrlKey: "pageSize",
pageIndexUrlKey: "pageIndex",
currentPageIndex: 0,
persist: false,
pageIndexChanging: function (event, args) {
pageIndexChanged: function (event, args) {
}
name: "Selection",
mode: "row"
name: "Updating",
enableAddRow: true,
editMode: "row",
editRowEnded: function (evt, ui) {
if (ui.update || ui.rowAdding) {
// alert('saving');
$("#SecuritySubs").igGrid("saveChanges");
saveChangesErrorHandler: function (jqXHR, textStatus, errorThrown) {
// debugger
$("#message").text("An error occurred while saving the changes. Error details: " + errorThrown);//.fadeIn(3000).fadeOut(5000);
enableDeleteRow: true,
rowEditDialogContainment: "owner",
showReadonlyEditors: false,
enableDataDirtyException: false,
showDoneCancelButtons: true,
columnKey: "IDX",
readOnly: true
columnKey: "BarraModelId",
editorType: "text"
columnKey: "BarraId",
editorType: "text",
columnKey: "AltBarraId",
validation: true,
required: true,
width: "900px",
height: '400px'
//dataSource: subs,
});
I set the grid to use the updateUrl: "Main.aspx/Update". The method signature on the back end is the following.
[System.Web.Services.WebMethod(EnableSession = true)]
public static bool Update()
return true;
The method does not get called. I am calling the saveChanges function but no server method gets called. How do I use updating within aspx.
Thanks,
John
Hello John,
Thank you for the provided information.
I am currently exploring the received configuration.
I will come back with an update as soon as possible.
In the meantime, in case you have additional questions feel free to ask them.
Best Regards
Have you come up with a solution? The only thing I can think to do is execute an $.ajax(...) update request from the editRowEnded event, turn autoCommit to false and control that myself, and get rid of the updateURL property.
Also, A second question. I have hidden fields in the grid that I would like to update when another field is updated. This works ok when we are update existing rows but does not for a new row. I tried updating the ui.values in the editRowEnded event but this does not get reflected in the grid. Do you have a solution for that?