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

<!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>Test DetailsView</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" AutoGenerateRows="False"
            DataKeyNames="id_agence" DataSourceID="SqlDataSource1" Height="50px" Width="125px" OnItemUpdating="DetailsView1_ItemUpdating">
            <Fields>
                <asp:BoundField DataField="id_agence" HeaderText="N&#176;agence" InsertVisible="False"
                    ReadOnly="True" SortExpression="id_agence" />
                <asp:BoundField DataField="nom_agence" HeaderText="Agence" SortExpression="nom_agence" />
                <asp:CommandField DeleteText="Supprimer" EditText="Modifier" InsertText="Ajouter"
                    NewText="Nouveau" SelectText="S&#233;lecitonner" ShowDeleteButton="True" ShowEditButton="True"
                    ShowInsertButton="True" UpdateText="Valider" />
            </Fields>
        </asp:DetailsView>
        <br />
        &nbsp;</div>
        <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)"
            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>
    </form>
</body>
</html>
