Can't hide Export to Excel or Export to Word buttons

3 posts, 1 answers
  1. Laurie
    Laurie avatar
    141 posts
    Member since:
    Feb 2007

    Posted 01 Jul 2013 Link to this post

    I'm attaching a jpg of what I see.  I want the export to word and export to excel buttons to go away and for the row that contains them to go away.  Here's the code from my .aspx file:

    <telerik:RadGrid ID="rgFields" runat="server" OnNeedDataSource="rgFields_NeedDataSource"
        AutoGenerateColumns="False" CellSpacing="0" GridLines="None" OnItemDataBound="rgFields_ItemDataBound"
        OnItemCreated="rgFields_ItemCreated" MasterTableView-CommandItemDisplay="None">
        <MasterTableView DataKeyNames="FieldID" AllowFilteringByColumn="false" AllowSorting="false" AllowPaging="false" PageSize="1000"
            CommandItemSettings-ShowExportToExcelButton="false" CommandItemSettings-ShowExportToWordButton="false"
            CommandItemSettings-ShowAddNewRecordButton="false" CommandItemSettings-ShowRefreshButton="false">
            <Columns>
                <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="FieldName" HeaderText="Field" UniqueName="FieldName">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="FieldType.FieldTypeName" HeaderText="Type" UniqueName="FieldTypeName">
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>

    The only other thing I have going on is I reference a skin in App_Themes that has the following code:

    <telerik:RadGrid runat="server" AllowPaging="True" AllowSorting="True"
        AllowFilteringByColumn="true" GridLines="None" AutoGenerateColumns="False" Skin="Default"
        PagerStyle-AlwaysVisible="true" PagerStyle-PageSizeLabelText="Number of entries per page:">
        <MasterTableView CommandItemDisplay="top">
            <CommandItemSettings ShowExportToWordButton="True" ShowExportToExcelButton="True" />
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                <HeaderStyle Width="20px" />
            </RowIndicatorColumn>
            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                <HeaderStyle Width="20px" />
            </ExpandCollapseColumn>
        </MasterTableView>
        <HeaderStyle Font-Bold="true" VerticalAlign="top" />
        <ExportSettings ExportOnlyData="True" IgnorePaging="True" OpenInNewWindow="True" />
        <GroupingSettings CaseSensitive="false" />
        <AlternatingItemStyle VerticalAlign="Top" />
        <ItemStyle VerticalAlign="Top" />
    </telerik:RadGrid>

    I'm guessing that this might be messing me up, but I can't figure out how/why.  I'd like to keep the skin, as it works well for 99% of my grids.

    Any ideas would be much appreciated.

    Thanks!

    Laurie
  2. Answer
    Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1803 posts

    Posted 04 Jul 2013 Link to this post

    Hi Laurie,

    Thank you for contacting us.

    As it seems from your code, you are trying to override RadGrid settings "ShowExportToWordButton" and "ShowExportToExcelButton" defined in the theme.

    I am assuming that you are applying the theme by setting the page`s Theme property. In that case the settings from the theme override any page settings on the control (due to higher priority of the page`s Theme). 

    Overriding theme setting from the control would be possible if you are applying theme as a style sheet theme by setting the page`s StyleSheetTheme property instead of page`s Theme property (as documented in this article).

    Please let us know if you need further assistance.


    Regards,
    Konstantin Dikov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Laurie
    Laurie avatar
    141 posts
    Member since:
    Feb 2007

    Posted 05 Jul 2013 Link to this post

    Worked like a charm.  I had the theme defined in my web.config, and simply changed Theme= to StyleSheetTheme= and, voila, my excel and word icons were gone.

    Thanks!
Back to Top