Note that there are some explanatory texts on larger screens.

plurals
  1. POTelerik Grid - Export to CSV more columns than displayed on screen
    primarykey
    data
    text
    <p><strong>Problem:</strong> How to display more columns in a Telerik grid than are displayed in the rendered grid?</p> <p>eg I'd like to only display on the screen the Surname, but on dump to csv would like firstname too.</p> <p>I've tried visible = false, and display = false on the GridBoundColumns, but then they don't come out on the csv.</p> <pre><code>&lt;telerik:RadGrid ID="grdAuctions" runat="server" AllowAutomaticDeletes="True" AllowAutomaticUpdates="True" AllowPaging="False" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="odsAuctionSales" GridLines="None" EnableEmbeddedSkins="False" OnItemDataBound="grdAuctionSales_ItemDataBound"&gt; &lt;ExportSettings HideStructureColumns="true" /&gt; &lt;MasterTableView Width="100%" CommandItemDisplay="Top"&gt; &lt;PagerStyle Mode="NextPrevNumericAndAdvanced" /&gt; &lt;CommandItemSettings ShowAddNewRecordButton="false" ShowRefreshButton="false" ShowExportToCsvButton="true" ExportToCsvImageUrl="~/Images/excel.jpg" ExportToCsvText="Export to csv" /&gt; &lt;/MasterTableView&gt; &lt;MasterTableView DataKeyNames="Id" DataSourceID="odsAuctionSales" CssClass="listItems" Width="98%"&gt; &lt;SortExpressions&gt; &lt;telerik:GridSortExpression FieldName="Name"&gt;&lt;/telerik:GridSortExpression&gt; &lt;/SortExpressions&gt; &lt;RowIndicatorColumn&gt; &lt;HeaderStyle Width="20px"&gt;&lt;/HeaderStyle&gt; &lt;/RowIndicatorColumn&gt; &lt;ExpandCollapseColumn&gt; &lt;HeaderStyle Width="20px"&gt;&lt;/HeaderStyle&gt; &lt;/ExpandCollapseColumn&gt; &lt;Columns&gt; &lt;telerik:GridTemplateColumn UniqueName="Edit"&gt; &lt;ItemTemplate&gt; &lt;asp:HyperLink ID="edit" runat="server" Text="Edit"&gt;&lt;/asp:HyperLink&gt; &lt;/ItemTemplate&gt; &lt;/telerik:GridTemplateColumn&gt; &lt;telerik:GridBoundColumn DataField="NameOnTable" HeaderText="Name On Table" SortExpression="NameOnTable" UniqueName="NameOnTable"&gt; &lt;/telerik:GridBoundColumn&gt; &lt;telerik:GridBoundColumn DataField="Surname" HeaderText="Surname" SortExpression="Surname" UniqueName="Surname"&gt; &lt;/telerik:GridBoundColumn&gt; &lt;telerik:GridBoundColumn DataField="Firstname" HeaderText="Firstname" SortExpression="Firstname" UniqueName="Firstname"&gt; &lt;/telerik:GridBoundColumn&gt; </code></pre> <p><strong>Edit</strong> Here is how I got it working</p> <pre><code>protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) { if (e.CommandName == RadGrid.ExportToCsvCommandName) { grdAuctions.MasterTableView.GetColumn("Edit").Visible = false; grdAuctions.MasterTableView.GetColumn("DPSAuthCode").Visible = true; grdAuctions.MasterTableView.ExportToCSV(); } } </code></pre> <p>and in the aspx</p> <pre><code>OnItemCommand="RadGrid1_ItemCommand" </code></pre> <p>and</p> <pre><code> &lt;telerik:GridBoundColumn DataField="DPSAuthCode" HeaderText="DPSAuthCode" Visible="false" SortExpression="DPSAuthCode" UniqueName="DPSAuthCode"&gt; &lt;/telerik:GridBoundColumn&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload