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

<%@ 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">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Outlook Demo</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <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="Outlook" Width="500px" PageSize="5" AllowSorting="True"
            AllowMultiRowSelection="True" AllowPaging="True" ShowGroupPanel="True" GridLines="None"
            AutoGenerateColumns="False">
            <PagerStyle Mode="NextPrevAndNumeric">
            </PagerStyle>
            <MasterTableView DataKeyNames="MailID,Flagged" DataMember="Mails" AllowMultiColumnSorting="True"
                Width="724px" TableLayout="Fixed">
                <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>
                        <ItemStyle Height="35px"></ItemStyle>
                        <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="300px"></HeaderStyle>
                        <ItemStyle Height="35px"></ItemStyle>
                        <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>
                        <ItemStyle Height="35px"></ItemStyle>
                        <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" UseStaticHeaders="True"></Scrolling>
            </ClientSettings>
        </telerik:RadGrid>
    </div>
    </form>
</body>
</html>
