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

"Undifined" When calling from Client Side

2 Answers 62 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
James Shelton Agar
Top achievements
Rank 2
James Shelton Agar asked on 12 Mar 2009, 04:39 AM
Hi, there, Just trying to change item status from Clientside and got an undifined error
here is my code
<telerik:RadToolBar ID="ToolListing" runat="server" CssClass="toolbar" OnClientButtonClicking="onToolButtonClick">  
                <collapseanimation type="None"></collapseanimation> 
                <items> 
                    <telerik:RadToolBarButton runat="server" CommandName="ALL" Text="All" Value="ALL" 
                        ImageUrl="~/Images/Icons/select_all_new.png" ImagePosition="AboveText" PostBack="False">  
                    </telerik:RadToolBarButton> 
                </items> 
</telerik:RadToolBar> 
  <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">  
 
        <script type="text/javascript">  
      <!--  
 function onToolButtonClick(sender, args) {  
                 if (args.get_item().get_commandName() == 'ALL') {  
                    var atoolBar = $find("<%=ToolListing.ClientID %>");  
                    atoolbar.findItemByValue("ALL").set_enabled(false);  
                    args.set_cancel(true);  
                }  
            }  
            
 -->        
        </script> 
 
    </telerik:RadCodeBlock> 


Strange it will actually not work
any idea?

2 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 12 Mar 2009, 10:48 AM
Hi James Shelton Agar,

The problem is the incorrect casing of atoolBar (the real object) and atoolbar (undefined).

You can change it or, even better, to use the sender object.

You can further optimize the code by using this one:

function onToolButtonClick(sender, args) { 
     var item = args.get_item();   
     if (item.get_commandName() == 'ALL') {   
        item.set_enabled(false);   
        args.set_cancel(true);   
    }   
}  

I hope this helps.

Greetings,
Veselin Vasilev
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.
0
James Shelton Agar
Top achievements
Rank 2
answered on 12 Mar 2009, 08:40 PM
u r absolute right.... oops
Tags
ToolBar
Asked by
James Shelton Agar
Top achievements
Rank 2
Answers by
Veselin Vasilev
Telerik team
James Shelton Agar
Top achievements
Rank 2
Share this question
or