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
Thank you for the hidden values... it appears I was doing this in the wrong event. I have yet another question about Filtering. I am attempting to do this remotely within an aspx page. Do you have an example of this? I have read the documentation but cannot figure out how the back end gets called.
Hello John,
I am sorry for the delay.
Regarding the question about updating the hidden columns you can handle the editRowEnding event. Since the updating isn’t finished you can change the values field of the ui param which would result in change the column value.
For example if you have a column with key “HiddenColumn” and want to set the value after adding new row to “default value”:
editRowEnding: function (evt, ui) {
if(ui.rowAdding) {
ui.values["HiddenColumn"] = "default value";
I have attached a sample showing this solution. You can try to first add row and then show the “HiddenColumn” to show its value.
Regarding the initial matter about SaveChanges:
I still can’t quite figure out why the update method is not called. The grid does make the call but the server side doesn’t seem to handle it. I will continue to investigate the issue.
In the meantime you can try to use manually ajax requests to the server.
I will get back to you with an update of the progress by the end of 03/01/2018.
Kind Regards
UpdateHiddenCellsSample.zip
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?
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