<%@ Page Language="c#" Inherits="Telerik.GridExamplesCSharp.Programming.WebMail.DefaultCS" CodeFile="DefaultCS.aspx.cs" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!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">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-language" content="en" />
<title>The Grid Control for ASP.NET: Ajax support, codeless databinding</title>
<meta name="description" content="The Grid Control for ASP.NET: Ajax support, codeless databinding" />
<meta name="keywords" content="grid control, ASP.NET, Ajax support, RadGrid, codeless DataBinding, hierarchical grids " />
<meta name="author" content="Telerik" />
<style type="text/css">
html,body,form,#RadGrid1Panel{width:100%;height:100%;margin:0;padding:0}
html{overflow:auto}
div{outline:none}
.GridPager_Office2007{height:20px}
</style>
</head>
<body>
    <form runat="server" id="mainForm" method="post">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"/>
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Width="75px" Transparency="50">
                <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border:0;" />
            </telerik:RadAjaxLoadingPanel>
            <telerik:RadGrid ID="RadGrid1" runat="server" Skin="Office2007" Width="100%" Height="100%" PageSize="10" AllowSorting="True"
                AllowMultiRowSelection="True" AllowPaging="True" ShowGroupPanel="True" GridLines="None"
                AutoGenerateColumns="False" style="border:0">
                <PagerStyle Mode="NextPrevAndNumeric">
                </PagerStyle>
                <MasterTableView DataKeyNames="MailID,Flagged" DataMember="Mails" AllowMultiColumnSorting="True"
                    TableLayout="Fixed" Width="100%" Height="100%">
                    <GroupByExpressions>
                        <telerik:GridGroupByExpression>
                            <SelectFields>
                                <telerik:GridGroupByField FieldAlias="Received" FieldName="Received"></telerik:GridGroupByField>
                            </SelectFields>
                            <GroupByFields>
                                <telerik:GridGroupByField FieldAlias="Received" SortOrder="Descending" FieldName="Received">
                                </telerik:GridGroupByField>
                            </GroupByFields>
                        </telerik:GridGroupByExpression>
                    </GroupByExpressions>
                    <Columns>
                        <telerik:GridTemplateColumn UniqueName="TemplateColumn4" Groupable="False">
                            <HeaderStyle Width="20px"></HeaderStyle>
                            <ItemTemplate>
                                <asp:Image ID="ImportantImage" BorderWidth="0px" 
                                    ImageUrl='<%# Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "Important"))? "img/Important_transparent.gif" : "img/Important_grey.gif" %>'
                                    AlternateText="Importance" Style="float: right; cursor: pointer;" runat="server">
                                </asp:Image>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridClientSelectColumn Reorderable="False" UniqueName="ClientSelectColumn">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </telerik:GridClientSelectColumn>
                        <telerik:GridTemplateColumn UniqueName="TemplateColumn1" Groupable="False">
                            <HeaderStyle Width="20px"></HeaderStyle>
                            <ItemStyle HorizontalAlign="Center" Height="35px"></ItemStyle>
                            <ItemTemplate>
                                <img src="img/MailIcon.gif" style="margin-bottom: 10px; margin-left: 2px" alt="MailIcon" />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="TemplateColumn2" GroupByExpression="From Group By From"
                            SortExpression="From" HeaderText="From / Subject">
                            <HeaderStyle Width="241px"></HeaderStyle>
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "From") %>
                                <br />
                                <div class="MailSubject">
                                    <%# DataBinder.Eval(Container.DataItem, "Subject") %>
                                </div>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn UniqueName="Received" SortExpression="Received" HeaderText="Received"
                            DataField="Received">
                            <HeaderStyle Width="125px"></HeaderStyle>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="FolderName" SortExpression="FolderName" HeaderText="FolderName" DataField="FolderName">
                            <HeaderStyle Width="70px"></HeaderStyle>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="Size" SortExpression="Size" HeaderText="Size" DataField="Size">
                            <HeaderStyle Width="35px"></HeaderStyle>
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn UniqueName="TemplateColumn3" Groupable="False">
                            <HeaderStyle Width="20px"></HeaderStyle>
                            <ItemTemplate>
                                <asp:ImageButton ID="MailFlagImageButton" BorderWidth="0px" CommandName="ChangeFlag"
                                    ImageUrl='<%# Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "Flagged"))? "img/MailFlagRed.gif" : "img/MailFlag.gif" %>'
                                    AlternateText="Change Flag" Style="float: right; cursor: pointer;" runat="server">
                                </asp:ImageButton>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                    </Columns>
                    <ExpandCollapseColumn Visible="False">
                        <HeaderStyle Width="19px" />
                    </ExpandCollapseColumn>
                </MasterTableView>
                <ClientSettings AllowDragToGroup="True">
                    <Selecting AllowRowSelect="True"></Selecting>
                    <Scrolling AllowScroll="True"></Scrolling>
                </ClientSettings>
            </telerik:RadGrid>
    </form>
</body>
</html>
