I'm trying to send a GridDataItem object that's retrieved from the selected row of a RadGrid.
But I'm getting an Uncaught RangeError: Maximum call stack size exceeded error when I make this AJAX call.
When I run the code, my AJAX success fires, but the breakpoint I have on the WebMethod never hits. After this, the pages freezes momentarily, then I get the error I mentioned above.
$(document).ready(function () {
$('#<%=btnTransferIn.ClientID%>').on('click', function () {
var grid = $find("<%= gridStudents.ClientID %>"); //Returns an Object
var gridSelItems = grid.get_selectedItems(); //Returns Array
var selectedItem = gridSelItems[0]; //Returns an Object
AjaxTransfer(gridSelItems);
});
});
function AjaxTransfer(selectedItem) {
$.ajax({
type: "POST",
url: "GradeSheet2.aspx/btnTransferIn_Click",
data: { 'gsi': selectedItem },
dataType: "json",
contentType: "application/json; charset=utf-8",
success: alert('Complete')
})
}
This is the WebMethod I want to call:
[System.Web.Services.WebMethod]
public static string btnTransferIn_Click(GridDataItem gsi)
{
return "Done";
}
I noticed, if I change the WebMethod's parameter to a string and I pass in a string instead of an object, it works. So it seems like there's something wrong with the object or the way I'm passing it to the WebMethod.
I checked the object in the console before I make the AJAX call and I think it looks alright.. Although, I don't have a high understanding of all of it.
http://i.stack.imgur.com/TUv8C.png
Please let me know if more information is needed.
Thanks in advance!