<%@ Page Language="C#" MasterPageFile="~/MasterPage/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="address_book_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="menuleft" Runat="Server">
   
    <a runat="server" id="tag_novo_contacto" title="Voltar">Novo Contacto</a>
    
    </asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="menurigth" Runat="Server">
    <asp:Label ID="utilizador_ultima_actualizacao" runat="server" Text="Label" />
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="main" Runat="Server">
    
    <h1> Agenda  </h1>
    <p title="titulo"> 
        <asp:TextBox ID="text_box_pesquisa" runat="server"></asp:TextBox>
        &nbsp;
        <asp:Label ID="Label1" runat="server" Text="Por:"></asp:Label>
        &nbsp;
        <asp:DropDownList ID="drop_down_esquisa" runat="server">
            <asp:ListItem>Nome</asp:ListItem>
            <asp:ListItem>Tipo</asp:ListItem>
        </asp:DropDownList>
        &nbsp;
        <asp:Button ID="button_pesquisar" runat="server" Text="Pesquisar" CausesValidation = "true"
            onclick="Button_Pesquisar_Click" />
        &nbsp;
        <asp:Button ID="button_reset" runat="server" Text="Reset" OnClick="Button_Reset_Click" CausesValidation = "false"/>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
        ControlToValidate="text_box_pesquisa" CssClass="validate" 
        ErrorMessage="Campo de pesquisa por preencher" Display="Dynamic"></asp:RequiredFieldValidator>
        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
            ControlToValidate="text_box_pesquisa" CssClass="validate" 
            ErrorMessage="Este campo não pode conter caracteres especiais" 
            ValidationExpression="^[0-9a-zA-Z.]{1,30}"  Display="Dynamic"></asp:RegularExpressionValidator>
    </p> 
    
    <asp:Label ID="Label2" runat="server" Text="Listar apenas os começados por: "></asp:Label>
    
    
    <asp:PlaceHolder runat="server" ID="placeholder_letras" ></asp:PlaceHolder>
    <br /><br />
   
        <asp:GridView ID="grid_view_contactos" runat="server" 
        AllowSorting="True" AutoGenerateColumns="False" AllowPaging="True" 
        CellPadding="4" ForeColor="#333333" 
        GridLines="None">
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#EFF3FB" />
            <Columns>
                <asp:BoundField DataField="NOME" HeaderText="Nome" ReadOnly="True" />
                <asp:BoundField DataField="TIPO" HeaderText="Tipo" ReadOnly="True" />
                
                <asp:HyperLinkField Text="Editar" 
                DataNavigateUrlFields="ID_CONTACTO" 
                DataNavigateUrlFormatString="Update.aspx?id={0}" 
                />
                
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:LinkButton ID="HyperLink1" runat="server"
                            CausesValidation=false
                            OnClientClick="return confirm('Deseja eliminar este contacto?');"
                            OnClick="Delete_Section"
                            CommandArgument=<%# Eval("ID_CONTACTO","Delete.aspx?id={0}")%>
                            Text="Remover"></asp:LinkButton>
                    </ItemTemplate>
                    <HeaderStyle ForeColor="White" />
                </asp:TemplateField>
                                
                 <asp:HyperLinkField Text="Detalhes" 
                DataNavigateUrlFields="ID_CONTACTO" 
                DataNavigateUrlFormatString="Detail.aspx?id={0}" 
                />
            </Columns>
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
  
    
</asp:Content>
