Atlas causing javascript conflicts?

Last post 07-23-2006 5:54 PM by Luis Abreu. 15 replies.

Sort Posts:

  • Atlas causing javascript conflicts?

    01-25-2006, 8:16 PM
    • Member
      75 point Member
    • EricAppel
    • Member since 01-22-2006, 8:12 AM
    • Posts 15
    I am using an UpdatePanel that contains several LinkButtons and a GridView control.  The LinkButtons are used to select/deselect all of the checkboxes in a column of my GridView.  I am also using a javascript library that implements javascript tooltips.  When the page loads the javascript tooltips work, but after I click the LinkButtons and the GridView is updated the tooltips no longer work.  When I remove the ScriptManager and the UpdatePanel from the page and allow the GridView to postback the tooltips work correctly.  I also ran into a similar issue when I was including another javascript library to do dynamic image reflections.  When that library was being used paging would not work on the GridView.  As soon as I removed the other javascript library the GridView paging worked.  Any ideas on how these conflicts can be resolved so that I can use other javascript libraries alongside Atlas?

    Thanks,
    Eric
  • Re: Atlas causing javascript conflicts?

    01-25-2006, 10:43 PM
    • Star
      13,895 point Star
    • bleroy
    • Member since 04-12-2003, 7:09 AM
    • Redmond
    • Posts 2,296
    • AspNetTeam

    It's really hard to say without seeing your code. It kind of looks like your tooltips library is initializing at some point using the ids on the page, but it's not expecting the page to change in a major way after it's initialized. Maybe this tooltip library needs to be reinitialized after an Atlas update panel has been refreshed?

    So I don't think it's a conflict as much as this other library not expecting the kind of stuff Atlas does (Atlas uses namespaces to minimize the chances of conflict). For tooltip, did you look at the popup behavior?

    Bertrand
    ----
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Atlas causing javascript conflicts?

    01-26-2006, 12:09 AM
    • Member
      75 point Member
    • EricAppel
    • Member since 01-22-2006, 8:12 AM
    • Posts 15
    Thanks for the response.  I'm somewhat of a newbie to javascript so I'm not sure how to reinitialize the javascript after the UpdatePanel has been refreshed?  What you are saying makes sense though, as the library requires that you put the link to the script at the bottom of the document.  I tried moving the reference to the tooltip script into the ContentTemplate of the UpdatePanel and this resulted in Atlas working correctly at first but then the page goes completely blank and seems to hang.  I also diffed the page source before and after I clicked the LinkButton in the UpdatePanel and the source was identical.  Nothing changes between the pages except for checkbox selection.  What part of my source would be useful for you to see?  It's really just a pretty standard Gridview inside of an UpdatePanel.  The javascript tooltip library that I am using can be found here http://www.walterzorn.com/tooltip/tooltip_e.htm

    Thanks,
    Eric
  • Re: Atlas causing javascript conflicts?

    01-26-2006, 3:45 AM
    • Member
      5 point Member
    • sarpmg
    • Member since 09-27-2005, 7:51 AM
    • Netherlands
    • Posts 1

    Hi,

    The new Atlas javscript definetly causing conflicts
    I tried using script.aculo.us (http://script.aculo.us) with atlas, and i'm getting javscript errors too...


    When i remove the atlas script manager javascript tag:
    <script src="ScriptLibrary/Atlas/Debug/Atlas.js" type="text/javascript"></script>

    The script.aculo.us scripts just works fine

    Sivy Sarwan
    Software Architect
    http://www.feedels.com
  • Re: Atlas causing javascript conflicts?

    01-26-2006, 3:26 PM
    • Star
      13,895 point Star
    • bleroy
    • Member since 04-12-2003, 7:09 AM
    • Redmond
    • Posts 2,296
    • AspNetTeam

    Well, you could also say that script.aculo.us is causing conflicts ;). We really can't ensure compatibility with other libraries that act on a very fundamental level (like extending Object and Function). We use namespaces to avoid the risk of collision, but there's really no way around the fundamental OOP stuff that we do. I think script.aculo.us relies on the prototype library that's similar to our atlasruntime.js and that's probably where the incompatibility really is.

    I can see what scenarios would need such compatibility: using ASP.NET with UpdatePanel on the server and a third party library on the client, but I don't think there's a way we can ensure the compatibility with every other library out there.

    Bertrand
    ----
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Atlas causing javascript conflicts?

    01-26-2006, 6:13 PM
    • Member
      36 point Member
    • portman
    • Member since 01-26-2006, 11:08 PM
    • Washington DC
    • Posts 9
    "I don't think there's a way we can ensure the compatibility with every other library out there."

    That's an extremely unfair statement in response to the original question. Prototype is not just "some library", it's a very popular, well-tested, and well respected library that is the underpinning of virtually all of today's Ajax-like web sites.

    It a website doesn't render correctly on IE6, you can't say "Oh there is no way for me to ensure the compatibility with every single browser out there". Sure you can... you test with IE6 because it is the market leader. Prototype is the same way.

    I found this thread because I am researching an incompatibility between Prototype (which I use for pretty little animation effects) and ATLAS (which I use for core updatepanel kind of stuff). I think the ASP.NET and Atlas teams really need to take into account Prototype compatibility.
  • Re: Atlas causing javascript conflicts?

    01-26-2006, 6:35 PM
    • Star
      13,895 point Star
    • bleroy
    • Member since 04-12-2003, 7:09 AM
    • Redmond
    • Posts 2,296
    • AspNetTeam

    How do you maintain compatibility between two libraries that essentially extend the *same* objects? Prototype is not a browser, and it's not a standard either. There is no official documentation that I could find, and we just can't look at the source code for obvious legal reasons. From some of the unofficial documentation that's floating around on the web, I can confirm that it extends the same objects that Atlas is extending, like for example Array.

    Asking for compatibility between Atlas and Prototype is like asking for compatibility between ASP and PHP. I don't see that happening. Sorry.

    Bertrand
    ----
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Atlas causing javascript conflicts?

    01-26-2006, 7:02 PM
    • Member
      36 point Member
    • portman
    • Member since 01-26-2006, 11:08 PM
    • Washington DC
    • Posts 9
    "and we just can't look at the source code for obvious legal reasons"

    I agree that there is no way to maintain compatibility between two JavaScript libraries if you can't look at the source code for one of them, particularly if they both have the same intent (bringing OOP principles to JavaScript 1.5). I withdrawal my request for Atlas-Prototype compatibility.

    However, if it somday becomes legally permissible look through the source (http://dev.rubyonrails.org/browser/spinoffs/prototype/), then I think you'll find it possible -- maybe not a piece of cake but definitely possible -- to avoid incompatibilities.

    Also, I feel sorry for you gusy! I've been looking at Atlas.js and AtlasRuntime.js and all the while I thought you were modeling Prototype or Rico or X or one of those frameworks. It's a shame that there has had to be so much "recreating of the wheel".

    There's a compelling business case to recreate the wheel when you're dealing with licensed, compiled code. But with a JavaScript framework, your entire source is exposed. Just seems like the perfect opportunity to "stand on the shoulders of giants" instead of writing a bunch of plumbing for extending Object and Array.


  • Re: Atlas causing javascript conflicts?

    01-26-2006, 7:20 PM
    • Star
      13,895 point Star
    • bleroy
    • Member since 04-12-2003, 7:09 AM
    • Redmond
    • Posts 2,296
    • AspNetTeam

    There sure is a lot of duplication of effort here but you should also know that the design decisions we have to put into Atlas are often far-reaching as there are many constraints that may not be initially visible and that may not exist for other frameworks (like consistency with the .NET framework wherever possible, MSN using our stuff, etc.). So even if it was possible for us to stand on top of things like Prototype, it would probably not fit our needs.

    While it may seem a little silly to say that we can't look at the source code whereas it's plain text that's downloaded by the browser, it doesn't matter from a legal standpoint. We just can't look at it, let alone use it. No more than we can use Reflector on third party .NET libraries to look at their source code. The technical aspect of it does not matter.

    I hope this clarifies.

    Bertrand
    ----
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Atlas causing javascript conflicts?

    01-27-2006, 12:05 AM
    • Member
      75 point Member
    • EricAppel
    • Member since 01-22-2006, 8:12 AM
    • Posts 15
    I'm still having issues with my orginal situation.  The javascript file that I'm trying to use can be found at http://ericappel.net/Groupr/scripts/wz_tooltip.js  It does not make use of the prototype library or anything else that would cause a conflict as far as I can tell.  Would you be able to look at it and see if anything in it would conflict with Atlas?  Again, they co-exist fine until Atlas updates the GridView, however, after the GridView is updated the tooltips stop working.  The page source is identical before and after the update happens (According to firefox anyways).

    Thanks,
    Eric
  • Re: Atlas causing javascript conflicts?

    01-27-2006, 2:28 PM
    • Star
      13,895 point Star
    • bleroy
    • Member since 04-12-2003, 7:09 AM
    • Redmond
    • Posts 2,296
    • AspNetTeam
    Sorry, I can't look at their source code. Maybe you should contact the author of the library. From the documentation, it seems like they're doing a lot at load time, and when we update the page, this script does not re-run. So the updated grid did not get the initialization phase that happened on the first request. So maybe all you need to do is re-trigger that initialization phase somehow.
    Bertrand
    ----
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Atlas causing javascript conflicts?

    04-28-2006, 7:57 AM
    • Member
      5 point Member
    • JohnRock
    • Member since 04-28-2006, 11:24 AM
    • Posts 1
    Still, Atlas and javascript problems... here's how to recreate.  As you can see, I added a simple javascript function that is not being called from anywhere on my page. When I comment out the javascript function, the code mysteriously works. What gives? Any suggestions?

    VS 2005 version 8.0.50727.42
    .NET Framework version 2.0.50727
    Atlas


    A simple javascript function in the head of the html document
    <script language="javascript">
    function sayHelloAlex(){
      for(i = 0; i < 5; i++){
        alert('Hello Alex');
      } 
    }
    </script>
      --------------------------------------------
    <atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True"></atlas:ScriptManager>
    
    <atlas:UpdatePanel ID="upComments" runat="server">
    <ContentTemplate>
    <div>
    <asp:Button ID="btnAddComment" runat="server" Text="Click Me!" OnClick="btnAddComment_Click" /> 
    
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
    </div>
    </ContentTemplate> 
    </atlas:UpdatePanel>
    
     
      --------------------------------------------

     Code-behind:
    Protected Sub btnAddComment_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Label1.Text = "You just clicked the button"
    End Sub
     
  • Re: Atlas causing javascript conflicts?

    05-12-2006, 11:34 AM
    • Member
      50 point Member
    • vivus
    • Member since 04-23-2006, 2:02 AM
    • Posts 10
     
    <script type="text/javascript">
      /* <!CDATA[[ */
    function sayHello() {
      for(var i=0; i < 5; i++) {
          alert("heya i should have used the firefox javascript console =)");
      }
    }
    /* ]]> */
    </script>
     
  • Re: Atlas causing javascript conflicts?

    06-19-2006, 11:56 PM
    • Member
      10 point Member
    • singcall
    • Member since 11-30-2005, 8:27 AM
    • Posts 2

    I also have similar problems. I have javascripts inside the master page and obviously it conflicts with Atlas.

    But as Atlas is too powerful I have finally test every pieces of javascripts and throw away those that have conflicts!

    For example, I need to throw away the following code which is used to check/uncheck all checkboxes in the Gridview. My opinion is that there are often conflicts for new techs and I am already very satisfied with what I can get for now as lots of people are already putting efforts for this and it's totally free.

     

    //SelectAllCheckboxes: function to select all the checkboxes in the GridView
    
    function SelectAllCheckboxes(spanChk){
    
    // Added as ASPX uses SPAN for checkbox
    
    var oItem = spanChk.children;
    
    var theBox= (spanChk.type=="checkbox") ? 
    
    spanChk : spanChk.children.item[0];
    
    xState=theBox.checked;
    
    elm=theBox.form.elements;
    
    for(i=0;iif(elm[i].type=="checkbox" && 
    
    elm[i].id!=theBox.id)
    
    { 
    
    if(elm[i].checked!=xState)
    
    elm[i].click();
    
    
    }
    
    }
    
     
  • Re: Atlas causing javascript conflicts?

    07-22-2006, 12:16 AM
    • Member
      23 point Member
    • yendi
    • Member since 07-22-2006, 4:07 AM
    • Posts 7
    Yes, I'm having the same problem. I'm trying to use this js: http://www.huddletogether.com/projects/lightbox2/ 
    without ANY luck.

    Is there any way to accomplish running a javascript script inside an Update Panel?

    Help is really appreciated. I really need this to work!

    THANKS!
Page 1 of 2 (16 items) 1 2 Next >