This is a migrated thread and some comments may be shown as answers.
ExportToExcelText is not visible
4 Answers 10 Views
This is a migrated thread and some comments may be shown as answers.
prasadsa01
Top achievements
Rank 1
prasadsa01 asked on 30 Oct 2018, 02:19 PM

     Hello,

I am trying to display text next to export to excel button on the grid. However, it is not visible on the UI.

 

 <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid2"   Width="100%"   AllowFilteringByColumn="True"
            AllowSorting="True" AllowPaging="True" PageSize="7" runat="server" AutoGenerateColumns="False"   OnItemCommand="RadGrid1_ItemCommand"
            ShowStatusBar="false" EnableLinqExpressions="false">
<GroupingSettings CaseSensitive="false"></GroupingSettings>
            <MasterTableView CommandItemDisplay="Top"    CommandItemStyle-HorizontalAlign="Left"  DataKeyNames="InstitutionID" TableLayout="Fixed">
  <CommandItemSettings       ExportToExcelText="Export to Excel"   ShowExportToExcelButton="true" AddNewRecordText="Add new program" ShowAddNewRecordButton="true" ShowRefreshButton="false" />
                <Columns>
<%--<telerik:GridTemplateColumn AllowFiltering="false">
<ItemTemplate>
<asp:LinkButton ID="btnlnk" runat="server" OnClientClick="document.forms[0].target = '_blank';"    Text='Edit' OnClick="btnlnk_Click"/>
</ItemTemplate>
</telerik:GridTemplateColumn> --%>

                    <telerik:GridHyperLinkColumn FooterText="HyperLinkColumn footer" DataTextFormatString="Edit" DataNavigateUrlFields="InstPrgID,DegreeCode" UniqueName="InstPrgID1" DataNavigateUrlFormatString="/heirs/programinventory/editinventory.aspx?&PrgId={0}&DegCode={1}" AllowFiltering="false"   DataTextField="InstPrgID"></telerik:GridHyperLinkColumn>
<telerik:GridBoundColumn FilterDelay="2000" AllowFiltering="true"      AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" DataField="InstPrgID" UniqueName="InstPrgID"  HeaderText="Identifier"/>  
<telerik:GridBoundColumn FilterDelay="2000" AllowFiltering="true" ShowFilterIcon="false" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"  DataField="programTitle" UniqueName="programTitle"   HeaderText="Program Title"/>  
<telerik:GridBoundColumn FilterDelay="200" AllowFiltering="false" UniqueName="PrgDegree"  DataField="PrgDegree" HeaderText="Program Degree"/>
<telerik:GridBoundColumn UniqueName="PrgOffStatus"  DataField="PrgOffStatus" HeaderText="Program Offering Status" 
                        HeaderStyle-Width="200px">
                        <FilterTemplate>
                            <telerik:RadComboBox RenderMode="Lightweight" ID="RadComboBoxTitle"   DataSourceID="SqlDataSource2"  DataTextField="STATUS" DataValueField="STATUS"
                                  Width="200px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container, GridItem).OwnerTableView.GetColumn("PrgOffStatus").CurrentFilterValue %>'
                                runat="server" OnClientSelectedIndexChanged="TitleIndexChanged">
                            <Items>
                                            <telerik:RadComboBoxItem Text="All" Value="" />
                                                                                      
                                        </Items> 
                            </telerik:RadComboBox>
                            <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                                <script type="text/javascript">
function TitleIndexChanged(sender, args) {
var tableView = $find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID %>");
tableView.filter("PrgOffStatus", args.get_item().get_value(), "EqualTo");
                                }
                                </script>
                            </telerik:RadScriptBlock>
                        </FilterTemplate>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn Visible="false"  FilterDelay="200" AllowFiltering="false" UniqueName="InstitutionID"   DataField="InstitutionID"  HeaderText="Identifier"/>
    
<%--<telerik:GridBoundColumn Visible="false"   DataField="PrgOffStatus" UniqueName="PrgOffStatus"  HeaderText="Program Offering Status"/>--%>
<telerik:GridBoundColumn Visible="false"   DataField="CIPCode" UniqueName ="CIPCode"  HeaderText="CIP Code"/>
<telerik:GridBoundColumn Visible="false"   DataField="CIPDesc" UniqueName="CIPDesc" HeaderText="CIP Description"/>
<telerik:GridBoundColumn Visible="false"   DataField="ProgramTyp" UniqueName="ProgramTyp"  HeaderText="Program Type"/>
<telerik:GridBoundColumn Visible="false"   DataField="PrgOffStatus" UniqueName="PrgOffStatus"  HeaderText="Program Offering Status"/>
<telerik:GridBoundColumn Visible="false"   DataField="RequiredHours" UniqueName="RequiredHours"  HeaderText="Credit Or Contact Hours"/>
<telerik:GridBoundColumn Visible="false"   DataField="ProgramFocus" UniqueName="ProgramFocus"  HeaderText="Program Focus"/>
<telerik:GridBoundColumn Visible="false"   DataField="EduIndicator" UniqueName="EduIndicator"  HeaderText="Distance Education"/>
    <telerik:GridBoundColumn UniqueName="ProgramClass" DataField="ProgramClass" HeaderText="Classification" 
                        HeaderStyle-Width="200px">
                        <FilterTemplate>
                            <telerik:RadComboBox RenderMode="Lightweight" ID="RadComboBoxClass" DataSourceID="SqlDataSource1"  DataTextField="BHE_PROG_TYPE_LONG_DESC" DataValueField="BHE_PROG_TYPE_LONG_DESC"
                                  Width="200px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container, GridItem).OwnerTableView.GetColumn("ProgramClass").CurrentFilterValue %>'
                                runat="server" OnClientSelectedIndexChanged="ClassIndexChanged">
                             <Items>
                                            <telerik:RadComboBoxItem Text="All" Value="" />
                                             
                                        </Items> 
                            </telerik:RadComboBox>
                            <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
                                <script type="text/javascript">
function ClassIndexChanged(sender, args) {
var tableView = $find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID %>");  
tableView.filter("ProgramClass", args.get_item().get_value(), "EqualTo");
                                }
                                </script>
                            </telerik:RadScriptBlock>
                        </FilterTemplate>
                    </telerik:GridBoundColumn>
<telerik:GridBoundColumn FilterDelay="200" AllowFiltering="false" Visible="false" UniqueName="BoardApprovedPrgTitle" DataField="BoardApprovedPrgTitle" HeaderText="Board Approved Program Title"/>
<telerik:GridBoundColumn Visible="false"   DataField="YrsAppv" UniqueName="YrsAppv" HeaderText="Year Approved"/>
<telerik:GridBoundColumn Visible="false"   DataField="PublicName" UniqueName="PublicName"  HeaderText="Public Facing Name"/>
<telerik:GridBoundColumn Visible="false"   DataField="WebsiteURL" UniqueName="WebsiteURL"  HeaderText="Program URL"/>
<telerik:GridBoundColumn Visible="false"   DataField="DegreeType" UniqueName="DegreeType" HeaderText="Degree Type"/>
<telerik:GridBoundColumn Visible="false"   DataField="WIOA" UniqueName ="WIOA"  HeaderText="WIOA Eligible"/>
<telerik:GridBoundColumn Visible="false"   DataField="Duration" UniqueName="Duration" HeaderText="Duration"/>
<telerik:GridBoundColumn Visible="false"   DataField="OpenPublic" UniqueName="OpenPublic"  HeaderText="Open to Public"/>
<telerik:GridBoundColumn Visible="false"   DataField="SOCGrpID" UniqueName="SOCGrpID"  HeaderText="Program Group"/>
                    <telerik:GridBoundColumn Visible="false"   DataField="SOC1" UniqueName="SOC1"  HeaderText="SOC1"/>                    
                    <telerik:GridBoundColumn Visible="false"   DataField="SOC1DESC" UniqueName="SOC1DESC"  HeaderText="SOC1 DESC"/>
<telerik:GridBoundColumn Visible="false"   DataField="SOC2" UniqueName="SOC2"  HeaderText="SOC2"/>                    
                    <telerik:GridBoundColumn Visible="false"   DataField="SOC2DESC" UniqueName="SOC2DESC"  HeaderText="SOC2 DESC"/>
<telerik:GridBoundColumn Visible="false"   DataField="SOC3" UniqueName="SOC3"  HeaderText="SOC3"/>                    
                    <telerik:GridBoundColumn Visible="false"   DataField="SOC3DESC" UniqueName="SOC3DESC"  HeaderText="SOC3 DESC"/>
<telerik:GridBoundColumn Visible="false"   DataField="SOC4" UniqueName="SOC4"  HeaderText="SOC4"/>                    
                    <telerik:GridBoundColumn Visible="false"   DataField="SOC4DESC" UniqueName="SOC4DESC"  HeaderText="SOC4 DESC"/>
<telerik:GridBoundColumn Visible="false"   DataField="SOC5" UniqueName="SOC5"  HeaderText="SOC5"/>                    
                    <telerik:GridBoundColumn Visible="false"   DataField="SOC5DESC" UniqueName="SOC5DESC"  HeaderText="SOC5 DESC"/>
<telerik:GridBoundColumn Visible="false"   DataField="SOC6" UniqueName="SOC6"  HeaderText="SOC6"/>                    
                    <telerik:GridBoundColumn Visible="false"   DataField="SOC6DESC" UniqueName="SOC6DESC"  HeaderText="SOC6 DESC"/>
<telerik:GridBoundColumn Visible="false"   DataField="SOC7" UniqueName="SOC7"  HeaderText="SOC7"/>                    
                    <telerik:GridBoundColumn Visible="false"   DataField="SOC7DESC" UniqueName="SOC7DESC"  HeaderText="SOC7 DESC"/>
<telerik:GridBoundColumn Visible="false"   DataField="SOC8" UniqueName="SOC8"  HeaderText="SOC8"/>                    
                    <telerik:GridBoundColumn Visible="false"   DataField="SOC8DESC" UniqueName="SOC8DESC"  HeaderText="SOC8 DESC"/>
<telerik:GridBoundColumn Visible="false"   DataField="SOC9" UniqueName="SOC9"  HeaderText="SOC9"/>                    
                    <telerik:GridBoundColumn Visible="false"   DataField="SOC9DESC" UniqueName="SOC9DESC"  HeaderText="SOC9 DESC"/>
<telerik:GridBoundColumn Visible="false"   DataField="SOC10" UniqueName="SOC10"  HeaderText="SOC10"/>                    
                    <telerik:GridBoundColumn Visible="false"   DataField="SOC10DESC" UniqueName="SOC10DESC"  HeaderText="SOC10 DESC"/>
                    
                    

                
                </Columns>
<%--<CommandItemTemplate>
<div>
<table>
        <tr>
            <td width="30%">
                <asp:LinkButton ID="LinkButton8" Text="Add new program" CommandName="InitInsert" runat="server"></asp:LinkButton>
            </td>
            <td width="40%">
            </td>
            <td width="30%">
                <asp:LinkButton ID="LinkButton9" Text="Export to Excel" CommandName="ExportToExcel"  runat="server"></asp:LinkButton>
            </td>
        </tr>
    </table>
    </div>

 
</CommandItemTemplate>--%>

            </MasterTableView>
   
        </telerik:RadGrid>

4 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 01 Nov 2018, 03:53 PM
Hi there,

The ExportToExcelText sets the tooltip of the image button, not the label text.
Please refer to the solution provided in this blog post to achieve your goal -> https://www.telerik.com/forums/export-to-excel-button-text#tznHKBRnHEWKXN7D4l5jyA.

Regards,
Rumen
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.
0
prasadsa01
Top achievements
Rank 1
answered on 01 Nov 2018, 06:54 PM

Thanks! that certainly resolved the UI issue; however, export to excel is not working as it used to be.

Before making suggested changes, export to excel was working as per below function where was prompted to download excel file. After making the above changes, export to excel doesn't prompt for file download instead it loads excel grid in the same window.

What Can I do to export like it used to be?

Protected Sub RadGrid1_ItemCommand(sender As Object, e As GridCommandEventArgs)

log4net.Config.XmlConfigurator.Configure()
log = LogManager.GetLogger(GetType(INV_Inventory))
log.Info(e.CommandName)
If e.CommandName = RadGrid.ExportToExcelCommandName Then
log.Info(e.CommandName)
RadGrid2.MasterTableView.Columns.FindByUniqueName("InstPrgID").Visible = False
RadGrid2.MasterTableView.Columns.FindByUniqueName("programTitle").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("PrgOffStatus").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("CIPCode").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("CIPDesc").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("ProgramTyp").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("RequiredHours").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("ProgramFocus").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("EduIndicator").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("ProgramClass").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("BoardApprovedPrgTitle").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("YrsAppv").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("PublicName").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("WebsiteURL").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("DegreeType").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("WIOA").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("Duration").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("OpenPublic").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOCGrpID").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC1").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC1DESC").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC2").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC2DESC").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC3").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC3DESC").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC4").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC4DESC").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC5").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC5DESC").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC6").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC6DESC").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC7").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC7DESC").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC8").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC8DESC").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC9").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC9DESC").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC10").Visible = True
RadGrid2.MasterTableView.Columns.FindByUniqueName("SOC10DESC").Visible = True

RadGrid2.ExportSettings.FileName = "Inventory"
RadGrid2.ExportSettings.IgnorePaging = True
RadGrid2.ExportSettings.ExportOnlyData = True
RadGrid2.ExportSettings.OpenInNewWindow = False
RadGrid2.MasterTableView.UseAllDataFields = False
RadGrid2.ExportSettings.Excel.Format = GridExcelExportFormat.Biff
RadGrid2.MasterTableView.ExportToExcel()
ElseIf e.CommandName = RadGrid.InitInsertCommandName Then
Response.Redirect("/heirs/programinventory/addinventory.aspx")
End If
End Sub

 

 

 

 

0
Rumen
Telerik team
answered on 06 Nov 2018, 02:41 PM
Hi there,

Instead of adding a new button, you can add a text to the current export button using the following CSS classes:

<style>
        div.RadGrid .rgExpXLSIcon {
            width: 80px;
        }
 
        .RadGrid .rgExpXLSIcon:before {
            float: left;
            margin-top: 2px;
        }
 
        div.RadGrid .rgExpXLSIcon:after {
            content: "Export";
        }
    </style>


Regards,
Rumen
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.
0
prasadsa01
Top achievements
Rank 1
answered on 16 Nov 2018, 01:40 PM

Thanks!

 

This certainly works in Chrome, but not in IE.

 

Tags
Grid
Asked by
prasadsa01
Top achievements
Rank 1
Answers by
Rumen
Telerik team
prasadsa01
Top achievements
Rank 1
Share this question
or