[CLOSED] String.format defined in ExtJS and in ASP.NET Ajax

  1. #1

    [CLOSED] String.format defined in ExtJS and in ASP.NET Ajax

    I have a HTML Editor on a page with both Ext.net ResourceManager and ASP.NET ScriptManager. It seems like both javascript library has its own implementation of String.format . I am getting the javascript error:

    Sys.ArgumentException: The format string is invalid.
    Parameter name: format



    I tried to reproduce with a small example but can not get it to fail. My page is fairly complex so it will be hard to duplicate.


    From the callstack, this is what is being called:


    this.initFrame()
    b.write(this.getDocMarkup())
    return String.format('<html><head><style type="text/css">body{border: 0; margin: 0; padding: {0}px; height: {1}px; cursor: text}</style></head><body></body></html>',this.iframePad,a)


  2. #2

    RE: [CLOSED] String.format defined in ExtJS and in ASP.NET Ajax

    Hi Jacky,

    There was fix added to v1.0 svn a few weeks back that should have fixed this issue.


    Which version of the Toolkit are you using?


    Geoffrey McGill
    Founder
  3. #3

    RE: [CLOSED] String.format defined in ExtJS and in ASP.NET Ajax

    Ha. No wonder I couldn't reproduce it in my sandbox project which uses the latest 1.0 dlls. The actual application is using an older version of 1.0. I will update the app and give it a try. Thanks for the fast response!
  4. #4

    RE: [CLOSED] String.format defined in ExtJS and in ASP.NET Ajax

    Hmm...I am still getting this after upgrading the dlls in the application. Using v1.0.0.20473. What was the fix that was checked in. My page is a little weird in that the coolite script includes are added to the END of the page, not the beginning. Not sure if that would matter...
  5. #5

    RE: [CLOSED] String.format defined in ExtJS and in ASP.NET Ajax

    Hi,

    The fix/workaround was added near the bottom of /extnet/core/init/End.js.


    Search for "_stringFormat".


    Hope this helps.


    Geoffrey McGill
    Founder
  6. #6

    RE: [CLOSED] String.format defined in ExtJS and in ASP.NET Ajax

    Heh...this is like a Chicken or the Egg thing. On my pages, the ASP.NET Ajax framework gets loaded first. So it sets the String.format already to its implementation. When ExtJS gets loaded, it is doing an applyIf instead of apply so it leaves the ASP.NET Ajax implementation in place. When Ext.net gets loaded, it sets Ext._stringFormat to ASP.NET Ajax's String.format. So no matter what, String.format will always belong to ASP.NET Ajax....

    My current workaround is to just add the same ExtJS override using apply after the ExtJS scripts are loaded.





  7. #7

    RE: [CLOSED] String.format defined in ExtJS and in ASP.NET Ajax

    It may be a good idea to note somewhere that this conflict exists so if other people already have code that targets ASP.NET's String.format implementation, they wont be lost in the dark.
  8. #8

    RE: [CLOSED] String.format defined in ExtJS and in ASP.NET Ajax

    feel free to mark this as Solved since it's a corner case with my weird .NET 1.1 basepage that is registering the ExtJS scripts at the bottom
  9. #9

    RE: [CLOSED] String.format defined in ExtJS and in ASP.NET Ajax

    Yes, the fix we added to End.js makes an assumption that the Ext JS .js files are loaded before the ASP.NET Ajax files.

    You could work around by adding the following before the Ext JS scripts...


    Example


    var _stringFormat = String.format;

    Then after the Ext JS scripts are loaded, add the following...


    String.format = _stringFormat;

    Hope this helps.


    Geoffrey McGill
    Founder
  10. #10

    RE: [CLOSED] String.format defined in ExtJS and in ASP.NET Ajax

    Hi Geoff,
    How can I make sure that I load these scripts in the right place?

Similar Threads

  1. Replies: 18
    Last Post: Aug 16, 2012, 10:50 AM
  2. Replies: 6
    Last Post: Apr 03, 2012, 1:54 PM
  3. Replies: 0
    Last Post: Aug 10, 2010, 5:27 AM
  4. [CLOSED] Dynamic grid column format string and performance
    By jchau in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Nov 16, 2009, 3:10 PM
  5. Interesting comment by Microsoft on String.Format Issue
    By pkellner in forum Open Discussions
    Replies: 1
    Last Post: Dec 11, 2008, 1:59 PM

Posting Permissions