Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q1 2012 released 04/11/2012
select

Grid / Filtering Template Columns

Contact nameContact titleTemplateColumn CityCustom TemplateColumn Country
select
    
Page size:
select
 91 items in 8 pages
Maria AndersSales Representative Berlin Germany
Ana TrujilloOwner México D.F. Mexico
Antonio MorenoOwner México D.F. Mexico
Thomas HardySales Representative London UK
Christina BerglundOrder Administrator Luleå Sweden
Hanna MoosSales Representative Mannheim Germany
Frédérique CiteauxMarketing Manager Strasbourg France
Martín SommerOwner Madrid Spain
Laurence LebihanOwner Marseille France
Elizabeth LincolnAccounting Manager Tsawassen Canada
Victoria AshworthSales Representative London UK
Patricio SimpsonSales Agent Buenos Aires Argentina


  • Enter filter criteria by either:
    • Typing in the header textboxes and choosing filter options from the context filter menu or
    • Selecting an item from the dropdown list in the last column header
    • Each filter pattern will be persisted successfully on subsequent user entries

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="c#" AutoEventWireup="false" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.GridExamplesCSharp.Programming.FilteringTemplateColumns.DefaultCS" %>

    <%@ Register TagPrefix="custom" Namespace="Telerik.GridExamplesCS.Programming.FilteringTemplateColumns" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="telerik" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <%@ Register TagPrefix="telerik" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="telerik" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.QuickStart" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <telerik:HeadTag ID="Headtag2" runat="server"></telerik:HeadTag>
    </head>
    <body class="BODY">
        <form id="mainForm" method="post" runat="server">
            <telerik:Header ID="Header1" runat="server" NavigationLanguage="CS"></telerik:Header>
         <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
            <!-- content start -->
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
            <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" Width="97%" AllowFilteringByColumn="True"
                AllowSorting="True" PageSize="12" ShowFooter="True" AllowPaging="True" runat="server"
                AutoGenerateColumns="False" GridLines="None" ShowStatusBar="true">
                  <GroupingSettings CaseSensitive="false" />
                <MasterTableView EditMode="InPlace" AllowFilteringByColumn="True" ShowFooter="True"
                    DataKeyNames="CustomerID" TableLayout="Fixed">
                    <Columns>
                        <telerik:GridBoundColumn DataField="ContactName" HeaderText="Contact name">
                            <HeaderStyle Width="25%" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="Contact title"
                         AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false">
                            <HeaderStyle Width="25%" />
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn DataField="City" HeaderText="TemplateColumn City">
                            <HeaderStyle Width="25%" />
                            <ItemTemplate>
                                <%# Eval("City") %>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <custom:MyCustomFilteringColumn DataField="Country" FilterControlWidth="180px" HeaderText="Custom TemplateColumn Country">
                            <headerstyle width="25%" />
                            <itemtemplate>
                                 <img src='Img/<%# Eval("Country") %>.gif' alt="" style="vertical-align:middle;margin-right:7px;"/><%# Eval("Country") %>
                            </itemtemplate>
                        </custom:MyCustomFilteringColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
            <br />
            <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                ProviderName="System.Data.SqlClient" SelectCommand="SELECT CustomerID, ContactName, ContactTitle, Country, City FROM Customers"
                runat="server"></asp:SqlDataSource>
            <!-- content end -->
            <telerik:Footer ID="Footer1" runat="server"></telerik:Footer>
        </form>
    </body>
    </html>

Get more than expected!

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2012 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451