locked
MasterPage with Menu and ContainerPage with AJAX Tabs RRS feed

  • Question

  • User-448122991 posted

    I am trying to create a MasterPage with a basic menu structure that will link to Tabs on a page that is in a deeper file structure.  For example my Master Page is at the root, where one of my other pages with AJAX tabs resides in a sub folder called Settings.

    Like the following: Root - MasterPage.Master and then Root\Settings\Default.aspx

     

    I am trying to link a menu on the MasterPage to particular Tab and I can't figure out how to do that.


    I have a JavaScript that works as follows:

    myFunction(index)

    var myTabContainer = $find('<%=Tabs.ClientID%>');

    var activeTab = myTabContainer.get_activeTabIndex();

    myTabContainer.set_activeTabIndex(index);

     

    I can create an onclick event and that works great...

    However, if I am not on the /settings/default.aspx page...how can I call the page and then pass the onclick event?  So Basically, I would want to click on the menu, then if /settings/default.aspx page is not open yet, open the page and goto the tab number...but if the browser is already viewing the /settings/default.asp page...then just pop over to the correct tab.

     

    I hope that make sense...

    Thanks,

    Ron

    Monday, February 1, 2010 8:54 PM

Answers

  • User-725797108 posted

    Example:

    function goToTab(){ 
       try { 
    var myTabContainer = $find('<%=Tabs.ClientID%>');
    
    var activeTab = myTabContainer.get_activeTabIndex();
    
    myTabContainer.set_activeTabIndex(index);
    
       } 
       catch (e) { 
          if (e.description == "Object expected") { 
    
    Some code to set myTabContainer to default.aspx page
    
    var myTabContainer = $find('<%=Tabs.ClientID%>');
    
    var activeTab = myTabContainer.get_activeTabIndex();
    
    myTabContainer.set_activeTabIndex(index);
    
          } 
          else { 
             alert ("Other error" + e.description); 
          } 
       } 
    
    }
    
    


    Try this code.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 3, 2010 1:16 AM

All replies

  • User-725797108 posted

    Option 1:

    do 1 thing. On click you search for any component  on your default.aspx page. If that is not null call this function to pop to tab.

    else redirect to defaultpage and after that run this page.

    Option 2:

    Make default.aspx page default on a panel in your project, that means default page will always be open.

     

    Try which every suites your requiremnt and let me know.

    Tuesday, February 2, 2010 2:06 AM
  • User-448122991 posted

    Thank you for your suggestions! 

     

    On Option 1...do you have a sample?

     

    On Option 2...but I don't want the /settings/default.aspx to be the starting page, so I don't understand what you are suggesting.

     

    Tuesday, February 2, 2010 8:24 AM
  • User-725797108 posted

    Example:

    function goToTab(){ 
       try { 
    var myTabContainer = $find('<%=Tabs.ClientID%>');
    
    var activeTab = myTabContainer.get_activeTabIndex();
    
    myTabContainer.set_activeTabIndex(index);
    
       } 
       catch (e) { 
          if (e.description == "Object expected") { 
    
    Some code to set myTabContainer to default.aspx page
    
    var myTabContainer = $find('<%=Tabs.ClientID%>');
    
    var activeTab = myTabContainer.get_activeTabIndex();
    
    myTabContainer.set_activeTabIndex(index);
    
          } 
          else { 
             alert ("Other error" + e.description); 
          } 
       } 
    
    }
    
    


    Try this code.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 3, 2010 1:16 AM