We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Grids in UpdatePanel after add or update produce a JavaScript runtime errors

Thanks for your assistance in advance.

I have an accordion control holding different elements of an order, four elements are represented in ej:grids surrounded by update panels.  Two of the grids are using templates for editing the others are inline editing, so I am using the grid as the control that triggers the update.

When I preform an, add, update or delete I get this javascript error after my java executes:

JavaScript runtime error: Sys.InvalidOperationException: Could not find UpdatePanel with ID 'XXX'. If it is being updated dynamically then it must be inside another UpdatePanel.

I have looked at forums/121150/grid-custom-command-save-edit-grid-refresh-page but this did not solve my problem, and other examples use buttons.  I have added outside update panels but the error message remains unchanged.

can you point me to what I am missing:

Bruce


Attachment: XEditOrder_a957b7e4.zip

3 Replies

SR Sellappandi Ramu Syncfusion Team January 20, 2016 08:55 AM UTC

Hi Bruce,

Thanks for contacting Syncfusion support.

We have analyzed the reported issue at our end and found this can be caused by unclosed tag or missing end tag. When we use multiple update panel need to consider doing an asynchronous post back.

Please refer the online forum link,

http://stackoverflow.com/questions/3928253/could-not-find-updatepanel-with-id-xxx-if-it-is-being-updated-dynamically-the

http://forums.asp.net/t/1046285.aspx?Sys+InvalidOperationException+when+using+UpdatePanel

Note: We are unable to execute provided codes at our end, but we found that you have missed to use IsPrimaryKey property to ReferencesGrid and ContactsGrid.

We are unable to edit any row except the first row value in Grid, if isPrimaryKey property is not set to the primary key column. Please refer the knowledge base documentation.

KB: https://www.syncfusion.com/kb/2675/cant-edit-any-row-except-the-first-row-in-grid

Could you please share the following information to us, it will help us to provide the prompt solution.
1.       Check whether the reported issue reproduced in single grid with single UpdatePanel tag in your sample. Because we have created a sample with update panel but we are unable to reproduced.
2.       Check whether the reported issue occurred once removed the UpdatePanel tag in your sample.
3.       Kindly provide issue reproducing sample which is runnable mode with replication procedure.


Regards,
Sellappandi R



BS Bruce Stevenson January 21, 2016 03:18 PM UTC

Great suggestions;

I had seen the stackoverflow post, and re-examined it then viewed the post that linded to an additional support ticket and read all of that.  I had not see the Microsoft post, but it ended up with the same resolution for the situation that most closely resembled mine.
I built a new page not using the Accordion in the project to test the cross links between the grids and they all worked as designed.

I extended the solution from "Direct-Trac technical support incident 146633" (Add a summary to an Accordion control) to move the new div's into place with the same logic, then modified the onActive and onInActive functions to set the display the divs accordingly on the user input.

Q1 - all 5 grids contained in a <ContentSection> where experiencing the  JavaScript runtime error.
Q2 - the page was originally built with out the updatepanels, the functionality was ported from other pages where they had been developed, this chused a refresh issue removing data updates from the other content sections.
Q3 - it would take considerable time to build this page with simple supporting class structures.

my solution :
(Javascript:)
$(function () {
            $("#OrderAccordion .e-content").each(function (length) {
                var summary = '#s' + Accordion_content(length);
                var content = '#D' + Accordion_content(length);
                if (length == 0) {
                    $(summary).insertAfter($("#OrderAccordion .e-content")[length]);
                    $(summary).hide();
                    $(content).insertAfter($(summary));
                    $(content).show();
                }
                else {
                    $(summary).insertAfter($("#OrderAccordion .e-content")[length]);
                    $(content).insertBefore($(summary));
                }    
            });
        });

        function onInActivate(args) {
            var target = Accordion_content(args.inActiveIndex);
            $('#s' + target).show();
            //Syncfusion support community forum 121723
            if (target != 'x') {
                e = document.getElementById('D' + target);
                e.style.display = 'none';
            }
        }

        function onActivate(args) {
            if (args.activeIndex != undefined) {
                var target = Accordion_content(args.activeIndex);
                $('#s' + target).hide();
                //Syncfusion support community forum 121723
                if (target != 'x') {
                    e = document.getElementById('D' + target);
                    e.style.display = 'block';
                }
            }
        }

Thanks for the solution.
Bruce



SR Sellappandi Ramu Syncfusion Team January 22, 2016 12:22 PM UTC

Hi Bruce,

Thanks for the update.

We are happy to hear that your issues have been resolved.

Please get back to us if you have any queries. We are happy to assist you.

Regards,
Sellappandi R

Loader.
Up arrow icon