Add Tab to Parent from RadWindow

5 posts, 1 answers
  1. Kenneth Mazur
    Kenneth Mazur avatar
    18 posts
    Member since:
    Jul 2008

    Posted 22 Oct 2009 Link to this post

    I've been trying many different ways to successfully add a tab dynamically to a tabstrip on a parent page from a radwindow.  I will have many RadWindows open from a 1st tabstrip and shown / hidden from that tabstrip.  The first tabstrip will only show the Lists of records in those RadWindows.

    I have a 2nd tabstrip that is VerticalLeft that when a user clicks on a record from one of the 1st tabstrip RadWindows, code will execute via JS to 1. Open a new RadWindow showing the details of the record the user selected. and 2. Add a new tab to the 2nd tabstrip on the parent page that will control the showing of the new RadWindows with the details.

    I've tried to use the following code, but it errors out on the: var tab = new Telerik.Web.UI.RadTab(); and says: "Object doesn't support this property or method"
                    var tabStrip = GetRadWindow().BrowserWindow.OpenItems;
                    var tab = Telerik.Web.UI.RadTab();
                    tab.set_text("Case: " + id);
                    tabStrip.add(tab);

    I've tried to use the following code, but it errors out as well saying "No Such Interface Supported".
                    GetRadWindow().BrowserWindow().addTab("Testing");

    I'm using the following version: 2008, 3, 1314, 20

    These should both work as they are spelled out as methods to use to achieve this in the support forums and documentation.  What am I missing?  It's got to be something basic that I'm just not seeing.
    Thanks
    Ken
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 23 Oct 2009 Link to this post

    Hello Kenneth,

    From the information that you provided, I conclude that the code that you posted here is in the RadWindow's content page. If this is so, your logic will not work and the error is expected - this code should be executed in the main page where the tabstrip is.
    Note that the content and the parent page are different, separate pages. If you want to use tabstrip's API to create a new tab, you should create a function in the main page that does that and then call this function from within the RadWindow's content page by using GetRadWindow().BrowserWindow.createTab(); where createTab is the name of the function on the parent page. More information on how to call functions in RadWindows is available here.


    Best wishes,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Kenneth Mazur
    Kenneth Mazur avatar
    18 posts
    Member since:
    Jul 2008

    Posted 23 Oct 2009 Link to this post

    The code is indeed, in the RadWindow page.  I've tweaked the code a little as you suggested, and it now errors out saying "Object doesn't support this property or method".
                    GetRadWindow().BrowserWindow.addTab("Testing");

    I have the function on the parent page as follows:
       <script>
           function addtab(passedvalue)
              {
                 var tabStrip = $find("<%# OpenItems.ClientID %>");
                 var tab = Telerik.Web.UI.RadTab();
                 tabStrip.get_tabs().add(tab);
                 tab.set_text(passedvalue);
                 tab.select();
              }
       </script>

    I've also tried not passing a parameter, just in case.
    Thanks
    Ken
  4. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 26 Oct 2009 Link to this post

    Hello Kenneth,

    Check the name of the function that you try to call from within the RadWindow and the actual name of the function on your parent page.



    Best wishes,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Answer
    Poul Henningsen
    Poul Henningsen avatar
    194 posts
    Member since:
    May 2006

    Posted 26 Oct 2009 Link to this post

    @Kenneth: hint - JavaScript is case sensitive language, so

    GetRadWindow().BrowserWindow.addTab("Testing"); 
     
    should be: 
     
    GetRadWindow().BrowserWindow.addtab("Testing"); 

Back to Top