How do you show/hide buttons server-side?

5 posts, 0 answers
  1. Jeremy T. Fuller
    Jeremy T. Fuller avatar
    51 posts
    Member since:
    Aug 2012

    Posted 01 Apr 2009 Link to this post

    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 
  2. Jeremy T. Fuller
    Jeremy T. Fuller avatar
    51 posts
    Member since:
    Aug 2012

    Posted 01 Apr 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 02 Apr 2009 Link to this post

    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.
  5. Jeremy T. Fuller
    Jeremy T. Fuller avatar
    51 posts
    Member since:
    Aug 2012

    Posted 02 Apr 2009 Link to this post

    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.
  6. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 03 Apr 2009 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017