Error: “Maximum call stack size exceed” AJAX calling WebMethod

3 posts, 0 answers
  1. Bill
    Bill avatar
    1 posts
    Member since:
    Jul 2016

    Posted 05 Jul 2016 Link to this post

    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


        function AjaxTransfer(selectedItem) {
                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:

        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.

    Please let me know if more information is needed.  

    Thanks in advance! 

  2. Vasil
    Vasil avatar
    1606 posts

    Posted 06 Jul 2016 Link to this post

    Hi Bill,

    You could run it in IE/Edge in debug mode to see exactly where the exception is happening.

    It is most probably because of selectedItem is object that have ._owner property. The _owner is Grid object which have items property that contain the item. So in general you can not pass the item as object inside your query.

    If you need to send the data key for this item, you could add the field into ClientDataKeyNames property of the grid.
    Then you could do 

    data: { 'gsi': selectedItem._data.yourField }

    Or if you want to sent the index:
    data: { 'gsi': selectedItem._itemIndex } 
    data: { 'gsi': selectedItem._itemIndexHierarchical }

    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. Ramesh
    Ramesh avatar
    2 posts
    Member since:
    Jun 2017

    Posted 28 Aug 2017 Link to this post

    UI for ASP.NET AJAX Hi I am using telerik:RadEditor control when i try to load the file into editor window i am getting "Error while executing filter CleanAttributesFilter - RangeError: Maximum call stack size exceeded" error. im getting this error oly my file size is more then 3MB HTML text. Can some one help me out how to resolve this ?
Back to Top