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

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
    
    <h1 class="skjema-admin__page-title">
        Brukere
    </h1>

    <div class="mb-2">
        <a href="Invite.aspx">
            Inviter ny bruker
        </a>
    </div>
    <br/>

    <div>
        <asp:Label 
            runat="server" 
            ID="lblMessage" 
            ForeColor="Red">
        </asp:Label>

        <asp:GridView 
            runat="server" 
            ID="grid"
            DataKeyNames="Id"
            ItemType="eDocument.Server.Administrator.User.AdminUserWithCustomerRoles"
            AutoGenerateEditButton="False"
            SelectMethod="GetData"
            OnRowCommand="grid_OnRowCommand"
            CssClass="skjema-admin__table"
            Border="0"
            AutoGenerateColumns="false">

            <Columns>
                <asp:DynamicField DataField="Id" Visible="False" />
                <asp:DynamicField DataField="Username" />
                <asp:DynamicField DataField="DisplayName" />
                <asp:DynamicField DataField="Email" />
                <%--<asp:DynamicField DataField="Roles" />--%>
                <asp:TemplateField HeaderText="Roles">
                    <ItemTemplate>
                        <%#Eval("Roles")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Fjern tilgang">
                    <ItemTemplate>
                        <asp:LinkButton runat="server" CommandName="Action" ID="btnRevokeAccess" Text="Fjern tilgang" OnCommand="btnRevokeAccess_OnClick" CommandArgument='<%#Bind("Id") %>'>Fjern tilgang</asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <a href='Edit.aspx?id=<%#Eval("Id")%>'>Edit</a>
                        <%--<asp:linkbutton id="btnEdit" runat="server" commandname="Edit" text="Edit" />--%>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>

</asp:Content>
