JScript Exception in AJAX Control Toolkit

I ran across an exception "Microsoft JScript runtime error: ‘this._postBackSettings.async’ is null or not an object" the other day while writing some AJAX code with .Net AJAX Extensions for .Net framework 2.0.

The page I was developing was simply enough, basically, it just consists of a button and a textbox inside an update panel. Doing a search on the error turned out quite a few matches, and it seems that a lot of people are having the same issue.

After reading a couple of posts, I realized that the reasons given were either incorrect (i.e. did not solve the issue I had) or pretty vague. So, after carefully looking through the exception path within the JScript library, I realized that this might have been caused by the fact that the page does not have a default submit button.

So here is the solution:

Add an asp panel  around the submit button and the textbox, and set the DefaultButton property to the submit button. Now the the submit button should be working without triggering the JScript exception mentioned earlier.

    <asp:Panel ID="Panel1" runat="server"  DefaultButton="BtnSubmit">

 

Be Sociable, Share!

26 Comments

  1. Mark says:

    Thanks for the tip Kerry! This error had been driving me crazy, and you suggestion helped me resolve the problem.

  2. Craig says:

    Me too!! Thanks so much.

  3. Margot says:

    THANK YOU! Also past the point of crazy. My problem revolves around a text box only, no other controls, so I added a panel and a button and gave the button the following CssClass:
    .invisibleButton { visibility:hidden; }

    It’s so frustrating this has not been addressed yet (as far as I can tell)!

  4. Sudhir Tibrewal says:

    Thanks Kerry, your post really helped. But unable to understand the cause.

  5. Oli Pyke says:

    That worked for me too. Thank you.

  6. Deepak Gupta says:

    I didn’t get the exact problem. What actually causing this problem. Though I am able to fix this but what is the issue. I think if we can figure this out we may come onto the good solution for this error.

  7. Rich says:

    Thank you, kwong. This tip was exactly what I needed. After wading through several sites talking about a ModalPopupExtender and the like, your solution was concise and easy to implement.

  8. Dmitry says:

    Thank you very much!!!! Very usefull information !!!!

  9. Richard says:

    This totally worked after I changed all of my asp buttons on the page to “UseSubmitBehavior = False” in Properties. Thanks for the info!

  10. Softlion says:

    Thanks, that’s it !
    This should be documented in MSDN !!!

  11. Thanks! This also solved my problem after investigating hours there.

  12. RickM says:

    Per Richard’s comment, this solved my problem. However, I only had to add the “UseSubmitBehavior=false” to the button(s) inside my PopupControlID panel, not the entire page.

  13. Don Kitchen says:

    My problem was not ajax control toolkit related or default button related. After some trial and error I was able to fix it. You can see the details here…

    http://www.donkitchen.com/2008/12/08/javascript-reporting-services-reportviewer-control-error-fix/

  14. hello says:

    thanks. really helped out after trying for hours to research and fix.

  15. Bill says:

    Thanks for the solution. It fixed my problem.

  16. Charlie says:

    solved my problem …. thanks so much!!

  17. Mike says:

    You: Rule

    Microsoft: FAIL

  18. Hein says:

    It Worked like a charm. Thanks.

  19. Debty says:

    Ahaan… I will follow.

  20. Joe says:

    Excellent solution…it works! I have been looking every where for the solution. Thanks.

  21. John Graffio says:

    A very simple solution emerges from the smoke!

  22. Rodolfo says:

    It solved my problem! After about one and a half hour spent searching for a solution, i got here! Thanks a lot, dude!

  23. khushant says:

    Thanks for the solution. It fixed my problem. Thanks a lot.

  24. Max says:

    Thanks Kerry, that fixed it! :-)

  25. Parimal says:

    thank you very much i solve problem with help that you provide… thanks..

Leave a Reply