<%@ Page Language="C#"%>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
        
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        foreach (GridDataItem item in RadGrid1.Items)
        {
            Label lbl = (Label)item.FindControl("Label1") as Label;
        }
    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" language="javascript">
        function requestStart() {
            //alert("started");
        }

        function responseEnd() {
            //alert("ended");
        }
    
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" />
    
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        <ClientEvents OnRequestStart="requestStart" OnResponseEnd="responseEnd" />
    </telerik:RadAjaxManager>
    <asp:Label ID="Label" runat="server"></asp:Label>
    
     <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" AllowPaging="True" ShowFooter="True" AllowFilteringByColumn="true"
            runat="server" AutoGenerateColumns="False" AllowSorting="True" PageSize="5" Width="925px"
            GridLines="None" CellPadding="0" Skin="Telerik" AllowMultiRowSelection="true" OnItemDataBound="RadGrid1_ItemDataBound">
            <PagerStyle Mode="NextPrevAndNumeric" />
            <MasterTableView ShowFooter="True">
                <Columns>
                    <telerik:GridTemplateColumn Display="false" ReadOnly="true" UniqueName="ContactName">
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("ContactName") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridEditCommandColumn FooterText="EditCommand footer" UniqueName="EditCommandColumn"
                        HeaderText="Edit&#160;Command Column">
                    </telerik:GridEditCommandColumn>
                    <telerik:GridClientSelectColumn UniqueName="CheckboxSelectColumn" HeaderText="CheckboxSelect column <br />" />
                    <telerik:GridBoundColumn FooterText="BoundColumn footer" UniqueName="ContactTitle" SortExpression="ContactTitle"
                        HeaderText="Bound<br/>Column" DataField="ContactTitle" >
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn FooterText="CheckBoxColumn footer" UniqueName="Bool" HeaderText="CheckBox<br/>Column"
                        DataField="Bool" AllowSorting="true">
                    </telerik:GridCheckBoxColumn>
                    <telerik:GridDropDownColumn FooterText="DropDownColumn footer" UniqueName="DropDownListColumn"
                        ListTextField="ContactName" ListValueField="ContactName" DataSourceID="SqlDataSource2"
                        HeaderText="DropDown<br/>Column" DataField="ContactName" AllowSorting="true">
                    </telerik:GridDropDownColumn>
                    <telerik:GridButtonColumn FooterText="LinkButtonColumn footer" DataTextFormatString="Remove selection"
                        UniqueName="column1" HeaderText="LinkButton<br/>Column" CommandName="Deselect"
                        DataTextField="CustomerID">
                    </telerik:GridButtonColumn>
                    <telerik:GridButtonColumn FooterText="ImageButtonColumn<br/>footer" DataTextFormatString="Select {0}"
                        ButtonType="ImageButton" UniqueName="column" HeaderText="ImageButton<br/>Column"
                        CommandName="Select" DataTextField="CustomerID" ImageUrl="Img/image.gif">
                    </telerik:GridButtonColumn>
                    <telerik:GridHyperLinkColumn FooterText="HyperLinkColumn footer" DataTextFormatString="Search Google for '{0}'"
                        DataNavigateUrlFields="CompanyName" UniqueName="CompanyName" DataNavigateUrlFormatString="http://www.google.com/search?hl=en&amp;q={0}&amp;btnG=Google+Search"
                        HeaderText="HyperLink<br/>Column" DataTextField="CompanyName">
                    </telerik:GridHyperLinkColumn>
                    
                    <telerik:GridTemplateColumn UniqueName="TemplateColumn" SortExpression="CompanyName" InitializeTemplatesFirst="false">
                        <FooterTemplate>Template footer</FooterTemplate>
                        <FooterStyle VerticalAlign="Middle" HorizontalAlign="Center" />
                        <HeaderTemplate>
                            <table id="Table1" cellspacing="0" cellpadding="0" border="0" style="width:240px;">
                                <tr>
                                    <td colspan="2" align="center" style="background: #dbdbdb;padding: 4px 0px;">
                                        <b>Contact details</b></td>
                                </tr>
                                <tr>
                                    <td style="width: 50%" align="center">
<asp:LinkButton CssClass="Button" ID="btnContName" Text="Contact name"
Tooltip="Sort by ContactName" CommandName='Sort' CommandArgument='ContactName' runat="server" /></td>
                                    <td style="width: 50%" align="center">
<asp:LinkButton CssClass="Button" ID="btnContTitle" Text="Contact title"
Tooltip="Sort by ContactTitle" CommandName='Sort' CommandArgument='ContactTitle'
runat="server" /></td>
                                </tr>
                            </table>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <table cellpadding="1" cellspacing="1" width="100%">
                                <tr>
                                    <td style="width: 50%">
                                        <%# Eval("ContactName") %>
                                    </td>
                                    <td style="width: 50%">
                                        <%# Eval("ContactTitle") %>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>
            <ClientSettings>
                <Selecting AllowRowSelect="true" />
            </ClientSettings>
        </telerik:RadGrid>
    
    <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM Customers"
            runat="server"></asp:SqlDataSource>
         <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT CustomerID, ContactName FROM Customers"
            runat="server"></asp:SqlDataSource>
    </div>
    </form>
</body>
</html>
