<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="List.aspx.cs" Inherits="eDocument.Server.Administrator.MailReceipts.List" MasterPageFile="~/Site.Master"  %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
    <div class="skjema-admin__page-pre-title">
        Forsendelse
    </div>

    <h1 class="skjema-admin__page-title mt-0">
        Kvitteringsepost
    </h1>

    <h2 class="skjema-admin__underline-title d-flex justify-content-between align-items-end">
        Kvitteringseposter
        <asp:Button 
            ID="btnCreate" 
            runat="server" 
            CssClass="skjema-admin__button skjema-admin__button--secondary mb-3"
            Text="Opprett ny"
            OnClick="btnCreate_OnClick" />
    </h2>

    <asp:Label 
        runat="server" 
        CssClass="skjema-admin__label"
        id="lblMessage" 
        ForeColor="Red">
    </asp:Label>

    <asp:GridView 
        runat="server" 
        ID="grid"
        DataKeyNames="Id" 
        ItemType="eDocument.Model.MailReceipt"
        AutoGenerateEditButton="False"
        SelectMethod="GetData"
        CssClass="skjema-admin__table skjema-admin__table--min-width-2"
        Border="0"
        Width="100%"
        AutoGenerateColumns="false">
        <Columns>
            <asp:DynamicField DataField="Id" Visible="False" />
            <asp:HyperLinkField HeaderText="Tittel" DataTextField="Name" DataNavigateUrlFields="Id" DataNavigateUrlFormatString="~/MailReceipts/Create.aspx?id={0}"/>
            <%--<asp:DynamicField DataField="Name" HeaderText="Tittel" />--%>
<%--            <asp:templatefield>
				<itemtemplate>
				    <a href='Create.aspx?id=<%#Eval("Id")%>'>Rediger</a>
				</itemtemplate>
            </asp:templatefield>--%>
            <asp:TemplateField HeaderText="<span class='skjema-admin__table__config-icon'></span>">
                <ItemTemplate>
                    <asp:LinkButton 
                        runat="server" 
                        CommandName="Action" 
                        id="btnRemove" 
                        Text="Fjern" 
                        OnCommand="btnRemove_OnCommand" 
                        CommandArgument='<%#Bind("Id") %>'>
                        Slett
                    </asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
</asp:Content>