This is a migrated thread and some comments may be shown as answers.

Object Expected Error when delcaring RadTab Client-side

3 Answers 82 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Tom M
Top achievements
Rank 1
Tom M asked on 27 Aug 2010, 09:11 PM
Greetings,

I am getting "Error: Object expected" when creating a new RadTab. Any ideas what could be causing this? It makes no sense to me, and it only happens when the script resides in a RadWindow.

function openingNewWindow(oWnd, title) {
    if (oWnd) {
        tabStrip.trackChanges();
        //create a new tab
        var tab = new Telerik.Web.UI.RadTab();
        //set the text of the tab
        tab.set_text(title);
        oWnd.correspondingTab = tab;
        //add the tab to the tabstrip
        tabStrip.get_tabs().add(tab);
        tabStrip.repaint();
        tab.correspondingWnd = oWnd;
        tab.set_imageUrl("../CSS/titlegraphic.gif");
        tabStrip.commitChanges();
        //Select this tab
        tab.select();
    }
}


Regards,
Tom

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 30 Aug 2010, 01:49 PM
Hello Tom,

The provided script seems correct. Can you send us more details? Where the tabStrip variable is set?

Regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tom M
Top achievements
Rank 1
answered on 30 Aug 2010, 09:36 PM
Hi Yana,

Thanks for your reply. I was setting the tabstrip variable like this on pageLoad..
function pageLoad() { 
    //get a reference to the needed controls - 
    var manager = GetRadWindow().get_windowManager(); 
    var tabStrip = $find("<%=RadTabStrip1.ClientID %>"); 
}

I think my problem was that I declared the openingNewWindow() function "twice". Once within my "main" page, and once in a page contained within a radWindow. Maybe this could mess things up? I was trying to use it like this because in my application you can open radwindows from within radwindows, and in both cases I need to add a reference to the MDI radTabStrip. I never resolved the issue but did wise-up and use the following approach successfully within the radwindowed page...

//when opening a radWindow from the "main" page..
function openingNewWindow(oWnd, title) {
    if (oWnd) {
        tabStrip.trackChanges();
        //create a new tab
        var tab = new Telerik.Web.UI.RadTab();
        //set the text of the tab
        tab.set_text(title);
        oWnd.correspondingTab = tab;
        oWnd.correspondingTabStrip = tabStrip;
        //add the tab to the tabstrip
        tabStrip.get_tabs().add(tab);
        tabStrip.repaint();
        tab.correspondingWnd = oWnd;
        tab.set_imageUrl("../CSS/titlegraphic.gif");
        tabStrip.commitChanges();
        //Select this tab
        tab.select();
    }
}

Then within the radwindowed page I just assign the tabStrip as such...

function pageLoad() {
    //get a reference to the needed controls -
    manager = GetRadWindow().get_windowManager();
    tabStrip = GetRadWindow().correspondingTabStrip;
}

...and when I need to call the "parent" page's openingNewWindow() function ( to add a tab item for the window to the tabstrip ) ....

var oBrowserWnd = GetRadWindow().BrowserWindow;
oWnd.moveTo(20, 30);
oWnd.setSize(885, 475);
oWnd.setActive();
oBrowserWnd.openingNewWindow(oWnd, "Title");

Regards,
Tom
0
Yana
Telerik team
answered on 02 Sep 2010, 03:11 PM
Hi Tom,

Could you please open a support ticket and send us a runnable pages demonstrating this issue as I'm not able to understand the exact approach. Thanks in advance

All the best,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TabStrip
Asked by
Tom M
Top achievements
Rank 1
Answers by
Yana
Telerik team
Tom M
Top achievements
Rank 1
Share this question
or