Hide Save Button

5 posts, 0 answers
  1. Mic
    Mic avatar
    7 posts
    Member since:
    May 2009

    Posted 07 Mar 2018 Link to this post

    Hi,
    Is there a way to hide the Save button in asp.net ajax spreadsheet control?

    Thanks

    Mic

  2. Peter Milchev
    Admin
    Peter Milchev avatar
    656 posts

    Posted 07 Mar 2018 Link to this post

    Hello Mic,

    One option to hide the Save button is to declare the Toolbar and add in it the desired buttons as demonstrated in the RadSpreadsheet - Telerik ASP.NET Spreadsheet and Spreadsheet - Full Set of Tools demos. 

    Another option would be hiding the button with JavaScript: 

    <script>   
        var $ = $ || $telerik.$;
        function f() {
            var spread = $find("<%= RadSpreadsheet1.ClientID%>");
            var homeToolbar = $(spread.get_element()).find(".RadToolBar")[0].control;
            // or
            // var homeToolbar = $(spread.get_element()).find(".rtbButton[title=Save]").closest('.RadToolBar')[0].control;
            homeToolbar.findItemByText("Save").hide();
            // Sys.Application.remove_load(f);
        }
        Sys.Application.add_load(f);
    </script>

    Regards,
    Peter Milchev
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Mic
    Mic avatar
    7 posts
    Member since:
    May 2009

    Posted 07 Mar 2018 Link to this post

    Thanks Peter,

    my web site is multi-language so I try this:

    ... 
     homeToolbar.findButtonByCommandName("ToolBarCommand").hide();

    It seems to work.

    Thanks

    Mic

  4. Saifulla
    Saifulla avatar
    15 posts
    Member since:
    Sep 2018

    Posted 03 Oct 2018 in reply to Peter Milchev Link to this post

    This works fine, but this not removes the tab strips. how can we do this.
  5. Peter Milchev
    Admin
    Peter Milchev avatar
    656 posts

    Posted 08 Oct 2018 Link to this post

    Hello Saifulla,

    To hide the TabStrip and the ToolBar, you can use the following code: 

    <script>
        var $ = $ || $telerik.$;
        function spreadsheetLoadEventHandler() {
            var spread = $find("<%= RadSpreadsheet1.ClientID%>");
            // hide the tabstrip (e.g. Home, Insert, Data)
            var tabStrip = $(spread.get_element()).find(".RadTabStrip")[0].control
            tabStrip.set_visible(false);
     
            // hide the toolbar (e.g. Save, Paste, Format, etc. )
            var homeToolbar = $(spread.get_element()).find(".RadToolBar")[0].control;
            homeToolbar.set_visible(false);
     
            // repaint the spreadsheet
            spread.get_kendoWidget().refresh()
     
            // Sys.Application.remove_load(f);
        }
        Sys.Application.add_load(spreadsheetLoadEventHandler);
    </script>


    Regards,
    Peter Milchev
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top