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

Disabling a toolbarbutton

4 Answers 111 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
jogi
Top achievements
Rank 1
jogi asked on 18 Feb 2009, 08:34 PM
Hi All,

I'd like to disable an item (prevent hover change, cursor/click changes etc.) in the toolbar that contains an image (company logo).  I've tried setting the enabled property to false, but that gives the toolbar a grayed out effect on the image which is not what I want.  Is there an easy way to do this? or am I going to need to start manipulating the dom programmatically?  Thanks in advance.

-jo

4 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 19 Feb 2009, 02:29 PM
Hi Jo,

I suggest you set  cssClass and Value properties of the logo button:

 <telerik:RadToolBarButton ImageUrl="Images/logo.gif" CssClass="logo" value="logo"  /> 

and use the following css styles to prevent the hightlight:

<style type="text/css">  
    .logo:hover,  
    .logo:hover .rtbOut,  
    .logo:hover .rtbMid,  
    .logo:hover .rtbIn {  
        backgroundnone !important;  
        cursordefault !important;  
    }  
</style> 

Also you have to subscribe to OnClientButtonClicking event of RadToolBar to prevent the click:

<script type="text/javascript">  
    function buttonClicking(sender, args)  
    {  
        if( args.get_item().get_value() == "logo")  
            args.set_cancel(true);  
    }  
</script> 

All the best,
Yana
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
jogi
Top achievements
Rank 1
answered on 19 Feb 2009, 06:34 PM
Thanks!
0
Softec
Top achievements
Rank 1
answered on 17 Mar 2009, 10:40 AM
Hi

Is there no way to prevent the opacity of a disabled Item? I'm trying to display some text in the toolbar to know which object will be manipulated. For this i add a disabled Button, set the CssClass Property and move it the end of the Toolbar like this:

.tbBez
   position: absolute;
right: 5px;
}

This works fine across all browsers but i can't get rid of the opacity. 
I tried setting my own DisabledCssClass like in the examples, but the opacity can't be overriden/disabled  =/

I don't want to include some javascript like in the suggestion above... There must be a way to do this by CSS.

Thanks for help

0
Softec
Top achievements
Rank 1
answered on 17 Mar 2009, 10:55 AM
I just got it working!

I had to override the CSS on the li tag (tbBezLeft / tbBezRight are my DisabledCssClasses)

.RadToolBar .tbBezLeft,
.RadToolBar .tbBezRight
{
-moz-opacity: 1 !Important;
opacity: 1 !Important;
}

But maybe somebody has a better solution...
Tags
ToolBar
Asked by
jogi
Top achievements
Rank 1
Answers by
Yana
Telerik team
jogi
Top achievements
Rank 1
Softec
Top achievements
Rank 1
Share this question
or