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

How do you show/hide buttons server-side?

4 Answers 271 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Jeremy T. Fuller
Top achievements
Rank 1
Jeremy T. Fuller asked on 01 Apr 2009, 07:20 PM
I am trying to hide and show buttons on a RadToolBar from the server. There doesn't appear to be an API to do this! (You'd think a simple .Visible property would be there.) I don't want to resort to fully removing the button if I can avoid it.

Note: I am not trying to disable the button. I don't want it to render, but I don't want it to be deleted either.

Suggestions?

toolbar.FindItemByText("text").Visible = false// This has no effect 
toolbar.FindButtonByCommandName("command")... // No Visible property here 
(toolbar.FindButtonByCommandName("command"as RadToolBarItem).Visible = false// This has no effect 

4 Answers, 1 is accepted

Sort by
0
Jeremy T. Fuller
Top achievements
Rank 1
answered on 01 Apr 2009, 07:30 PM
Apparently the ToolBar itself needs to be visible before any of it's buttons' Visible properties work. I need an entire toolbar to start out hidden, then become visible after an AJAX postback (via an UpdatePanel). While doing this, I also need to control the visibility of individual buttons on the toolbar.

For now, the workaround is to set Style="display:none;" on the toolbar and set it's Visible to true. I can then control the individual buttons' visibility using the Visible property on the server. When I want the toolbar itself to become visible, on the server I say toolbar.Style["display"] = "";

This seems unnecessarily awkward and buggy. Is this intended behavior? The Visible property on toolbar buttons should always work, regardless of the visibility of the toolbar itself.
0
Atanas Korchev
Telerik team
answered on 02 Apr 2009, 09:53 AM
Hi Jeremy T. Fuller,

I have attached a sample page which demonstrates how to show and hide items.

Regards,
Albert
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Jeremy T. Fuller
Top achievements
Rank 1
answered on 02 Apr 2009, 10:37 PM
You entirely missed the point of my post. When the toolbar itself is set to Visible = false, trying to modify the visibility of buttons on that toolbar fails. I consider this to be a bug in your product. Thanks.
0
Atanas Korchev
Telerik team
answered on 03 Apr 2009, 07:09 AM
Hi Jeremy T. Fuller,

I am not sure what do you mean. When the toolbar is Visible=false it will not render at all. Please elaborate more on your scenario. Ideally you could tell me how to modify my sample page in order to reproduce the problem you are having. Thanks.

Regards,
Albert
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
ToolBar
Asked by
Jeremy T. Fuller
Top achievements
Rank 1
Answers by
Jeremy T. Fuller
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or