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

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>GridView - simple</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="ID_COMPTE" DataSourceID="SqlDataSource1" AllowPaging="True" 
            AllowSorting="True" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" 
            BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:CommandField ShowEditButton="True" ShowSelectButton="True" />
                <asp:BoundField DataField="TITULAIRE" HeaderText="Titulaire compte" 
                    SortExpression="TITULAIRE" ReadOnly="True" />
                <asp:BoundField DataField="SOLDE" DataFormatString="{0:c}" HeaderText="Solde" 
                    SortExpression="SOLDE" />
            </Columns>
            <FooterStyle BackColor="#CCCC99" />
            <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
            <RowStyle BackColor="#F7F7DE" />
            <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#FBFBF2" />
            <SortedAscendingHeaderStyle BackColor="#848384" />
            <SortedDescendingCellStyle BackColor="#EAEAD3" />
            <SortedDescendingHeaderStyle BackColor="#575357" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:bancaConnectionString %>" 
            DeleteCommand="DELETE FROM [COMPTE] WHERE [ID_COMPTE] = @ID_COMPTE" 
            InsertCommand="INSERT INTO [COMPTE] ([TITULAIRE], [SOLDE], [ID_AGENCE]) VALUES (@TITULAIRE, @SOLDE, @ID_AGENCE)" 
            SelectCommand="SELECT * FROM [COMPTE]" 
            UpdateCommand="UPDATE [COMPTE] SET [TITULAIRE] = @TITULAIRE, [SOLDE] = @SOLDE, [ID_AGENCE] = @ID_AGENCE WHERE [ID_COMPTE] = @ID_COMPTE">
            <DeleteParameters>
                <asp:Parameter Name="ID_COMPTE" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="TITULAIRE" Type="String" />
                <asp:Parameter Name="SOLDE" Type="Decimal" />
                <asp:Parameter Name="ID_AGENCE" Type="Int32" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="TITULAIRE" Type="String" />
                <asp:Parameter Name="SOLDE" Type="Decimal" />
                <asp:Parameter Name="ID_AGENCE" Type="Int32" />
                <asp:Parameter Name="ID_COMPTE" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
