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

radTabStrip null is null or not an object

2 Answers 178 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Remi
Top achievements
Rank 2
Remi asked on 13 Aug 2008, 05:51 PM
Hello,

I'm using a radTabStrip menu, not multipage and at times, very random, I receive a "null is null or not an object" error when I click on a tab. I could successfully click the tab prior or after receiving the error but at times the error appears.

Here is some code for the javascript. 

<

script type="text/javascript" language="javascript">

function SelectMyTab(sender, args)

{

//var multiPageID = sender.get_multiPageID();

//sender.set_multiPageID(null);

args.get_tab().select();

//sender.set_multiPageID(multiPageID);

}

function UnSelectMyTab(e)

{

var tabStrip = $find('<%= MainNav.ClientID%>');

//Find the element which the mouse is over

var destElement = e.relatedTarget || e.toElement;

if ($telerik.isDescendant(tabStrip.get_element(), destElement))

return;

var initialTab = tabStrip.findTabByText("<%= MyTab %>");

initialTab.unselect();

initialTab.selectParents();

}

</

script>

As you can see I removed the multipage references. I'm wondering if that has something to do with it.

Basically, I don't want multipage. I want the tab to load a new .aspx page when clicked, which is what is happening. I have onstates set, mouseover and mouseout states.

I need to remove this error and resolve the null reference.

In debug mode, when the error occurs it breaks here:

if

($telerik.isDescendant(tabStrip.get_element(), destElement))

My RadTabStrip looks like this:

 <telerik:RadTabStrip ID="MainNav" runat="server" SelectedIndex="0"
                                AutoPostBack="True" Skin="MainTheme" EnableEmbeddedSkins="false"
                                OnClientMouseOver="SelectMyTab" onmouseout="UnSelectMyTab(event)"
                                ClickSelectedTab="true" UnSelectChildren="true"
                                ontabcreated="MainNav_TabCreated">
                               <Tabs>
                                   <telerik:RadTab ID="TabHome" runat="server" Text="Home" NavigateUrl="~/Default.aspx" onmouseover="changeIt(0);" onclick="setMouseOut(0);">
                                       <Tabs>
                                           <telerik:RadTab ID="Tab1" runat="server" Text="Tab 1" onmouseover="this.style.cursor='hand';" onmouseout="this.style.cursor='default';"  NavigateUrl="~/Tab1.aspx" />
                                          
                                           <telerik:RadTab ID="TabSeparator1" runat="server" IsSeparator="true" Text="|" />
                                          
                                           <telerik:RadTab ID="Tab2" runat="server" Text="Tab 2" onmouseover="this.style.cursor='hand';" onmouseout="this.style.cursor='default';"  NavigateUrl="~/Tab2.aspx" />
                                       </Tabs>
                                   </telerik:RadTab>

                                   <telerik:RadTab ID="TabExtended" runat="server">
                                        <Tabs>
                                            <telerik:RadTab ID="TabExtendedPH" runat="server" />
                                        </Tabs>   
                                   </telerik:RadTab>

                               </Tabs>
                           </telerik:RadTabStrip>

Any help is much appreciated, thanks in advance for your time and consideration.

2 Answers, 1 is accepted

Sort by
0
Remi
Top achievements
Rank 2
answered on 14 Aug 2008, 03:58 PM
This issue doesn't appear in FireFox, it seams to only appear in IE (using IE 7.0), not sure if prior versions of IE are affected.

Thanks,
0
Remi
Top achievements
Rank 2
answered on 15 Aug 2008, 02:06 PM
I got it to work without the null exception. I had to make some code adjustments. 

<

script type="text/javascript" language="javascript">

function SelectMyTab(sender, args)

{

//var multiPageID = sender.get_multiPageID();

//sender.set_multiPageID(null);

args.get_tab().select();

//sender.set_multiPageID(multiPageID);

}

function UnSelectMyTab(e)

{

var tabStrip = $find('<%= MainNav.ClientID%>');

//Find the element which the mouse is over

var destElement = e.relatedTarget || e.toElement;

var initialTab = null;

if (tabStrip != null && destElement != null)

{

if ($telerik.isDescendant(tabStrip.get_element(), destElement))

return;

initialTab = tabStrip.findTabByText(

"<%= MyTab %>");

//initialTab.unselect();

initialTab.selectParents();

}

}

</

script>

Thanks.

Tags
TabStrip
Asked by
Remi
Top achievements
Rank 2
Answers by
Remi
Top achievements
Rank 2
Share this question
or