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

set_cancel(false) Causing Error on Items Below Level 0

1 Answer 45 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Doug
Top achievements
Rank 1
Doug asked on 16 Aug 2009, 05:40 PM
Hello,

I get the following error whenever I click a PanelBar item below the top level:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Sun, 16 Aug 2009 17:29:00 UTC

Message: Object doesn't support this property or method
Line: 37
Char: 4
Code: 0

Here is the Javascript:

   function OnClientItemClickingHandler(sender, eventArgs)
   {
  
   var cookieName = constCookieName(sender.get_id());
   var curCookie = GetCookie(cookieName);
   var cookieValue = new Array();

   if(curCookie != null) {cookieValue = curCookie.split(",");}

   var itemIndex;

   for (i = 0; i < sender.get_items().get_count(); ++i)
   {
    if(sender.get_items().getItem(i).get_text() == eventArgs.get_item().get_text()) {itemIndex = i;break;}
   }

   if(eventArgs.get_item().get_expanded() == true)
   {
    eventArgs.get_item().set_expanded(false);
       document.getElementById("globalLinks").style.width = document.getElementById("LeftNavigationAreaCell").offsetWidth-15 + "px";
    cookieValue[itemIndex]=false;
   }
   else
   {
    eventArgs.get_item().set_expanded(true);
       document.getElementById("globalLinks").style.width = document.getElementById("LeftNavigationAreaCell").offsetWidth-15 + "px";
    cookieValue[itemIndex]=true;
   }

   document.cookie = cookieName + "=" + escape(cookieValue) + "; path=/";

  if(eventArgs.get_item().get_navigateUrl().toLowerCase().indexOf("go_nowhere") > -1)
  {     
   eventArgs.set_cancel(true);
  }else{
   eventArgs.set_cancel(false);  // This line causes error ;
  }
   }

I am unable to test the "true" condition of the corresponding statement at this time.  Thus, I do not know whether or not it causes the same error.

What am I doing wrong?

Cheers,

Doug 

1 Answer, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 20 Aug 2009, 11:08 AM
Hello Doug,

I think it will be best if you can open a formal support ticket and send us a simple running project (incl. CSS, images, DB backup and so on) demonstrating the problems. In that way we can reproduce and pinpoint the problems you're facing on our side, understand the logic of your application and provide a solution.

Kind regards,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
PanelBar
Asked by
Doug
Top achievements
Rank 1
Answers by
Paul
Telerik team
Share this question
or