Initial hidden button

3 posts, 1 answers
  1. mzn developer
    mzn developer avatar
    68 posts
    Member since:
    Jul 2005

    Posted 04 Nov 2008 Link to this post

    Hello,

    Is there a good way to hide a button on the toolbar initially and show it through javascript?  I tried the Visible property but then the button control isn't put on the page so the only way to show it would be through a postback. 
    I currently have it working by running javascript in the body onLoad but that causes the hidden buttons to show for a split second (or more on a slow machine/connection) before the javascript runs and hides them.

    The scenario where I'm trying to use this is where we display data and we also have an Edit mode to update that data.  We want an Edit button displayed initially and when you click edit a javascript function is called where we will switch to an edit mode with the fields and also hide the Edit button and show a Save and Cancel button on the toolbar.

    Any help is appreciated.

    Thanks.
  2. Answer
    Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 04 Nov 2008 Link to this post

    Hi,

    You can use the following approach:
    <telerik:RadToolBarButton style="display:none"... />

    <script type="text/javascript">
       function makeButtonVisible()
       {
           var toolBar = $find("<%=RadToolBar1.ClientID%>");
           var button = toolBar.get_items().getItem(0);
           button.set_visible(true);
       }
    </script>


    I hope this helps.

    Kind regards,
    Erjan Gavalji
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. mzn developer
    mzn developer avatar
    68 posts
    Member since:
    Jul 2005

    Posted 04 Nov 2008 Link to this post

    I had tried that previously but now I see the issue.  I'm currently on version 2008.1.619 and I see an issue that was fixed with the 2008.2.826 release for the display:none style being applied to the main element instead of the link element.  That's why I couldn't get it to work correctly.

    Time to upgrade.  Thanks for the help.
Back to Top