New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Word/CSV Export



CustomerIDCompany NameContact NameContact TitleAddressPostal Code
 Item 41 to 50 of 91
Page:
of 10 GoPage size:
LAMAILa maison d'AsieAnnette RouletSales Manager1 rue Alsace-Lorraine31000
LAUGBLaughing Bacchus Wine CellarsYoshi TannamuriMarketing Assistant1900 Oak St.V3F 2K1
LAZYKLazy K Kountry StoreJohn SteelMarketing Manager12 Orchestra Terrace99362
LEHMSLehmanns MarktstandRenate MessnerSales RepresentativeMagazinweg 760528
LETSSLet's Stop N ShopJaime YorresOwner87 Polk St. Suite 594117
LILASLILA-SupermercadoCarlos GonzálezAccounting ManagerCarrera 52 con Ave. Bolívar #65-98 Llano Largo3508
LINODLINO-DelicatesesFelipe IzquierdoOwnerAve. 5 de Mayo Porlamar4980
LONEPLonesome Pine RestaurantFran WilsonSales Manager89 Chiaroscuro Rd.97219
MAGAAMagazzini Alimentari RiunitiGiovanni RovelliMarketing ManagerVia Ludovico il Moro 2224100
MAISDMaison DeweyCatherine DeweySales AgentRue Joseph-Bens 532B-1180
  • Demo Configurator
This example demonstrates RadGrid's Export to Word / CSV formats. There are two ways to integrate the exporting functionality in RadGrid.
  • Codeless (built-in buttons in the CommandItem) - using the CommandItemSettings
  • Manually using the API - we have both server and client methods that can trigger the export

You can configure the exporting settings for the grid through the RadGrid.ExportSettingssection. Most commonly used settings include:

  • FileName - a string specifying the name (without the extension) of the file that will be created. The file extension is automatically added based on the method that is used
  • ExportOnlyData - determines whether only data will be exported
  • IgnorePaging - specifies whether all records will be exported or merely those on the current page
  • OpenInNewWindow - opens the exported grid in a new instead of the same page
  • UseItemStyles - gives you the ability to apply the item styles to the exported file

Note that the exporting feature of the control works with regular postbacks only. Therefore in this demo the new RadAjaxPanel's "PostBackControls" porperty is used for listing the controls that should be excluded from perfoming ajax requests. This property is available for the RadAjaxManager control also sinse Q1 2016 release.

  • DefaultVB.aspx
  • DefaultVB.aspx.vb
  • scripts.js
  • Styles.css
<%@ Page Language="vb" Inherits="Telerik.GridExamplesVBNET.Exporting.ExportToWordCSV.DefaultVB"CodeFile="DefaultVB.aspx.vb"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link rel="Stylesheet" type="text/css" href="styles.css" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <script type="text/javascript" src="scripts.js"></script>
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" PostBackControls="ImageButton1,ImageButton2,ImageButton3" CssClass="demo-container no-bg">
        <asp:ImageButton ID="ImageButton1" ImageUrl="images/file-extension-doc-icon_bigger.png"
            OnClick="Button1_Click" runat="server" CssClass="ImageButtons" />
        <asp:ImageButton ID="ImageButton3" ImageUrl="images/file-extension-docx-icon_bigger.png"
            OnClick="ImageButton3_Click" runat="server" CssClass="ImageButtons" />
        <asp:ImageButton ID="ImageButton2" ImageUrl="images/file-extension-csv-icon_bigger.png"
            OnClick="Button2_Click" runat="server" CssClass="ImageButtons" />
        <br />
        <br />
        <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" DataSourceID="SqlDataSource1" AllowSorting="True" Skin="Silk"
            AutoGenerateColumns="false" AllowPaging="True" PageSize="10" runat="server" OnItemCommand="RadGrid1_ItemCommand">
            <ExportSettings HideStructureColumns="true">
            </ExportSettings>
            <MasterTableView Width="100%" CommandItemDisplay="Top">
                <CommandItemSettings ShowExportToWordButton="true" ShowExportToCsvButton="true" ShowAddNewRecordButton="false" ShowRefreshButton="false" />
                <PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>
                <Columns>
                    <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID">
                        <HeaderStyle BackColor="#8EDDFF" Font-Bold="true" />
                        <ItemStyle BackColor="#B2F4FF" Font-Italic="true" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CompanyName" HeaderText="Company Name">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ContactName" HeaderText="Contact Name">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="Contact Title">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Address" HeaderText="Address">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="PostalCode" HeaderText="Postal Code">
                    </telerik:GridBoundColumn>
                </Columns>
                <ItemStyle BackColor="#DFDFDF" />
                <HeaderStyle BackColor="#FFFFFF" ForeColor="#767676" />
                <AlternatingItemStyle BackColor="#FFFFFF" />
            </MasterTableView>
        </telerik:RadGrid>
    </telerik:RadAjaxPanel>
    <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, PostalCode FROM Customers"
        runat="server"></asp:SqlDataSource>
    <qsf:ConfiguratorPanel ID="ConfiguratorPanel2" runat="server">
        <Views>
            <qsf:View>
                <ul class="fb-group">
                    <li>
                        <span class="checkbox">
                            <asp:CheckBox ID="CheckBox1" Text="Export only data" runat="server"></asp:CheckBox></span>
                    </li>
                    <li>
                        <span class="checkbox">
                            <asp:CheckBox ID="CheckBox2" Text="Ignore paging (exports all pages)" runat="server"></asp:CheckBox></span>
                    </li>
                    <li>
                        <span class="checkbox">
                            <asp:CheckBox ID="CheckBox3" Text="Open exported data in new browser window" runat="server"></asp:CheckBox></span>
                    </li>
                    <li>
                        <span class="checkbox">
                            <asp:CheckBox ID="CheckBox4" Text="Use item styles (Word doc-only)" runat="server"></asp:CheckBox></span>
                    </li>
                </ul>
            </qsf:View>
        </Views>
    </qsf:ConfiguratorPanel>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance