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

<!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>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:FormView ID="FormView1" runat="server" AllowPaging="True" DataKeyNames="id_agence"
            DataSourceID="SqlDataSource1">
            <EditItemTemplate>
                id_agence:
                <asp:Label ID="id_agenceLabel1" runat="server" Text='<%# Eval("id_agence") %>'></asp:Label><br />
                nom_agence:
                <asp:TextBox ID="nom_agenceTextBox" runat="server" Text='<%# Bind("nom_agence") %>'>
                </asp:TextBox><br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                    Text="Update">
                </asp:LinkButton>
                <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                    Text="Cancel">
                </asp:LinkButton>
            </EditItemTemplate>
            <InsertItemTemplate>
                nom_agence:
                <asp:TextBox ID="nom_agenceTextBox" runat="server" Text='<%# Bind("nom_agence") %>'>
                </asp:TextBox><br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                    Text="Insert">
                </asp:LinkButton>
                <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                    Text="Cancel">
                </asp:LinkButton>
            </InsertItemTemplate>
            <ItemTemplate>
                <table>
                    <tr>
                        <td style="width: 100px">
                            N°Agence</td>
                        <td style="width: 100px">
                            Agence</td>
                    </tr>
                    <tr>
                        <td style="width: 100px">
                            <asp:Label ID="id_agenceLabel" runat="server" Text='<%# Eval("id_agence") %>'></asp:Label></td>
                        <td style="width: 100px">
                            <asp:Label ID="nom_agenceLabel" runat="server" Text='<%# Bind("nom_agence") %>'></asp:Label></td>
                    </tr>
                </table>
            </ItemTemplate>
        </asp:FormView>
        <br />
        <br />
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:bancaConnectionString %>"
            DeleteCommand="DELETE FROM [agence] WHERE [id_agence] = @id_agence" InsertCommand="INSERT INTO [agence] ([nom_agence]) VALUES (@nom_agence)"
            OnSelecting="SqlDataSource1_Selecting" SelectCommand="SELECT * FROM [agence]"
            UpdateCommand="UPDATE [agence] SET [nom_agence] = @nom_agence WHERE [id_agence] = @id_agence">
            <DeleteParameters>
                <asp:Parameter Name="id_agence" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="nom_agence" Type="String" />
                <asp:Parameter Name="id_agence" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="nom_agence" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
        &nbsp;</div>
    </form>
</body>
</html>
