views:

662

answers:

2

Horribly worded question, I know...

I'm attempting to load a page into a div inside an asp:listview. The page loads fine on the first attempt, but subsequent loads do not seem to run the jquery.ui.js file to tabify the loaded page.

I moved the call to tab the loaded page into the callback function of the .load() function, but that hasn't resolved the issue any better. Code follows:

$(".clientModal").click(function() {
   var clientID = $(this).attr("title");
   if ($(this).hasClass("highlight")) {
    $('#ClientPanel' + clientID).slideToggle(200);
   }
   else {
    $('#ClientPanel' + clientID).load("Details.aspx?id=" + clientID, null, function() {
     $("#clientTabs").tabs();
     $('#ClientPanel' + clientID).slideToggle(200);
    });
   }
   $(this).toggleClass("highlight");
  });

This is inside of a function pageLoad() as we're using Microsoft Ajax as well, and want to do it on pageLoad rather than on document.ready. Any ideas as to why the jquery.ui would work fine on the initial load, but not on subsequent loads? Thanks!

Edit! Let me add some information in here. I have noticed that if I go back up from the bottom of the screen clicking the links, it operates as it should, shows the tabs and works correctly. However, if I go top down, it works for the first click and then subsequent clicks DOWN the tree don't work correctly, however, clicks UP the tree do.

Am I totally crazy here? :)

A: 

Try loading the jquery.ui files with your loaded page, as well as the page that is loading it. The loaded page may not know jquery.ui.

Lchi
Already tried it both ways. Doesn't seem to make any difference.
riceboyler
A: 

The problem was in calling the id of clientTabs. When moving up the tree, it had no problem because it found the first instance of #clientTabs and applied the UI, and when moving up, the first one was the one I wanted. When moving down, the first instance of #clientTabs was NOT the one I was calling, so it didn't work.

So, switched to a class reference ($(".clientTabs")) and it works beautifully now. Sometimes, classes are better than ids...

riceboyler