<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ExportToExcelHyperLinkColumn.aspx.cs" Inherits="ExportToExcelHyperLinkColumn" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <telerik:RadGrid ID="RadGrid2" runat="server" AllowPaging="True" GridLines="None"
        OnNeedDataSource="RadGrid2_NeedDataSource">
        <ExportSettings IgnorePaging="true" OpenInNewWindow="true" ExportOnlyData="true"
            FileName="RelatedContactsExport">
            <Excel Format="ExcelML" />
        </ExportSettings>
        <MasterTableView TableLayout="Auto" ShowHeadersWhenNoRecords="false" AutoGenerateColumns="false"
         UseAllDataFields="true">
            <Columns>
                <telerik:GridTemplateColumn HeaderText="Name" UniqueName="Name" HeaderStyle-Width="21%">
                    <ItemTemplate>
                        <%#Eval("CompanyName")%>,
                        <%#Eval("ContactName")%>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn HeaderText="Business Name" DataField="ContactTitle" UniqueName="BusinessName" />
                <telerik:GridTemplateColumn HeaderText="Address" UniqueName="Address">
                    <ItemTemplate>
                        <%#Eval("ContactTitle")%>
                        <%#Eval("Address")%>,
                        <%#Eval("City")%>
                        <%#Eval("Region")%>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="PostalCode" UniqueName="PhoneNumber" HeaderText="Phone"
                    HeaderStyle-Width="21%">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Fax" UniqueName="CellPhoneNumber" HeaderText="Cell" />
                <telerik:GridTemplateColumn HeaderText="Birthday" UniqueName="Birthday">
                    <ItemTemplate>
                        <%#Eval("Country")%>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridHyperLinkColumn DataTextFormatString="Search Google for '{0}'"
                        DataNavigateUrlFields="Phone" UniqueName="HyperLinkPhone" DataNavigateUrlFormatString="http://www.google.com/search?hl=en&amp;q={0}&amp;btnG=Google+Search"
                        HeaderText="Phone Column" DataTextField="Phone">
                    </telerik:GridHyperLinkColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    <br />
    <asp:Button ID="btnExportToExcel" runat="server" Text="Export to Excel" OnClick="btnExportToExcel_Click"/>
    </form>
</body>
</html>
